es6-promise

    0熱度

    1回答

    我需要有令牌來訪問像我的代碼公佈的內容。但我要做的就是複製)從loginUser(產生的令牌,並將其粘貼getAnnouncement()內下獲取。我寫的授權:「承載esuigiugeguigiguigi」 < ---這就是象徵。問題在於,我需要在每次過期時複製並粘貼令牌。 function loginUser(){ fetch('http://sample_website.com/api/a

    -1熱度

    2回答

    我想獲得一個嵌套的Promise.all *地圖邏輯工作。當我到達getData2時,我總是收到未定義的值。 exports.getData = (param1, param2) => { return getData0(param1, param2) .then(data0 => Promise.all(data0.map(e => getData1(e.id))))

    2熱度

    1回答

    我的應用有時會接收大量需要解析和渲染的數據。我想解析第一對消息,並渲染它們給用戶一些工作,而其餘的消息在後臺解析。問題是,下圖中的第一次渲染不會導致屏幕畫出Chrome,Firefox或Safari。 parse(data, show) { if (data === null) { ... } else { if (data.length >

    0熱度

    2回答

    我有一個類getter,我只想在事件偵聽器完成時才返回一個值。 有沒有辦法做到這一點? 我知道,我可以許諾把它包起來,並將其應用到鏈,但它不遵循模塊化我需要的應用程序的使用情況: class Request{ get body(){ console.log('processed before') console.log(processed) this.

    0熱度

    2回答

    你能幫我解釋一下如何編寫測試來捕捉錯誤嗎? 例如,我有這個假代碼: export default function someFunc (num) { return someOtherFunc(num).then(resp => { return resp + 1 }).catch(() => { return 0 }) } 這是以前的代碼

    3熱度

    2回答

    我開始與異步/等待在打字稿的事情,我對此有一些問題。我寫了這個函數從Blob獲取ArrayBuffer。 async function readAsArrayBuffer(blob: Blob): Promise<ArrayBuffer> { return new Promise<ArrayBuffer>((resolve, reject) => { let reader =

    0熱度

    1回答

    考慮例如: JS "use strict"; const input = [ "https://www.google.ru", "https://www.google.ru", "https://www.google.ru", "https://www.google.ru", "https://www.google.ru" ]; const

    0熱度

    1回答

    我有一種情況,我想處理多個承諾。 假設我有3變量 fileOption, setupOptions, moveOption 每個變量的基礎,我請求的功能,如 file.validate(token) .then((token) => file.create(fileOption)) .then((file) => setup ? file.getToken(userfrom

    1熱度

    1回答

    我想使用es6來保持此代碼稍微清潔,但是我的代碼創建致命錯誤unexpected token。我在這裏做錯了什麼? 例子:Works - old javascript ('/admin/candidate_profile/edit/contact_details/' + this.props.candidateUserId) 例子:Doesn't work - es6 {`/admin/can

    0熱度

    2回答

    簡短的問題:爲什麼在Javascript中沒有Promise.chain(相當於Promise.all)?我的實施是否? 我的「編解碼器」乖錯: 從XML文件 創建的所有節點讀取曲線(對創作方法返回一個承諾) 等待所有節點創作完成 創建節點之間的所有邊界 問題:數據庫的順序調用f或者節點創建(步驟2)在執行時混淆起來。 解決方案:在方法執行之前,我必須以正確的順序鏈接數據庫調用。 /** * c