[英]How to run a function when Ember finished loading for the first time
嗨,我正在編寫一個簡單的ember應用程序,我在node-webkit應用程序中運行,現在我想運行:
require("nw.gui").Window.get().show();
在Ember完成加載並且已經呈現索引視圖之后,但只是一次,如果您剛剛導航到/
。
我試過這個:
App.IndexRoute = Ember.Route.extend({
setupController: function(controller) {
require("nw.gui").Window.get().show();
}
});
但這會在每個導航上執行/
謝謝!
Ember.Application
有一個准備好的事件 。 這可以滿足您的需求。
你可以像這樣使用它:
window.App = Ember.Application.create({
ready: function () {
alert('Application ready!');
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.