最近碰到的 nodejs + Backbone,因為Backbone hardly depends on Underscore… 所以…
主要原因是因為需要在畫面 loading 完之後馬上依照某條件做一些處理,所以用到 .defer().
根據說明這函數是”Defers invoking the function until the current call stack has cleared”,所以適合拿來解決上述的問題。
window.PartnerView = Backbone.View.extend({
initialize: function () {
this.render();
_(function() {
// add things want do process till the current call stack has cleared.
}).defer();
}
}