rsvp.js

    1熱度

    1回答

    我試圖在兩個編譯步驟完成時運行一個函數,但成功回調不斷得到調用,即使一個失敗。下面的代碼: function compile(tplStr) { return new Promise(function(resolve,reject) { // compile template here var tpl = new function(){}; resolve(

    1熱度

    1回答

    我在我的EmberJS應用程序中實現了錯誤日誌記錄,如描述的here,它工作得很好。拋出我的唯一部分是如何正確處理來自Ember RSVP onerror事件的錯誤呼叫。 從Ember運行循環中產生的錯誤使用message和stack屬性很好地格式化,但RSVP引發的錯誤返回標準XHR響應並且沒有附加上下文。發生此錯誤時是否可以訪問有關正在執行的Ajax調用的任何信息? 我使用Ember 1.3.

    2熱度

    1回答

    我有一個類似於下面的路線,它從多個休息呼叫建立數據。 App.IndexRoute = Ember.Route.extend({ model: function() { var id = 1; //will get as url param later var modelData = {ab:{},ef:{}}; return ajaxPromise(

    0熱度

    1回答

    奇怪的問題,我猜... 我建立我的DOM在內存中,並大量使用promises。說我有這樣的for...循環中: target = document.createDocumentFragment(); promises = [], pass, skip, store; for (i = 0; i < foo; i += 1) { element = foo[i]; //

    4熱度

    2回答

    我正在使用ember.js和RSVP。 從我可以看到,沒有任何處理來自異步調用的超時。 我的想法是使用裝飾器模式封裝解析處理程序,將解析處理程序包裝在某些代碼中,以便在發生超時時會調用並調用拒絕。 這聽起來像是一個好主意,還是有一些內置的支持超時,我已經錯過了RSVP。

    5熱度

    1回答

    我想從路由的beforeSend鉤子內訪問我的路由控制器,以利用承諾邏輯上的暫停。 這是我目前的解決方法,可以在我的控制器上設置「category_config」,它是從beforeModel中的promise獲得的。 Imaging.ReferenceRoute = Ember.Route.extend(Imaging.Ajax, { setupController: function

    3熱度

    2回答

    重新RSVP.js:https://github.com/tildeio/rsvp.js 什麼是集成了jQuery的$就RSVP.js的最佳方式?在做了一些閱讀和研究之後,我看到在Ember中有圍繞它的包裝的積極發展... https://github.com/emberjs/ember.js/pull/4148 任何人都有這種使用情況的承諾嗎? 我正在使用RSVP.js,因爲我通過.all()方

    -2熱度

    1回答

    我可以承諾的RSVP陣列工作: //if user wants to change username var promises = []; promises['username'] = new RSVP.Promise(function(resolve, reject){ if(user.username !== session.username){ //check if u

    63熱度

    8回答

    我有一系列需要按順序運行的承諾。 var promises = [promise1, promise2, ..., promiseN]; 調用RSVP.all將並行執行它們: RSVP.all(promises).then(...); 但是,我怎麼能運行它們的順序? 我可以手動堆疊起來這樣 RSVP.resolve() .then(promise1) .then(pro

    0熱度

    3回答

    下面的代碼返回每個的getJSON方法的RSVP承諾: getJSON('/login') .then(getJSON('/errors').then(function(users) { self.user = users; })) .then(getJSON('contacts').then(function(contacts) { self.c