问题描述
我安装了 ember-prerender
(),使用提供的初始化器在/示例中,将其部署在我的一个服务器上。
但是当我尝试启动它时:
重新启动渲染器,在初始化
时,超时,即使我更改引擎(我用Phantom和jsdom尝试)
我最好的猜测是, XContentReady
事件永远不会被触发。
所以确实是 XContentReady
不是引发问题的引发。
我没有添加触发事件的mixin:
mixins / ember-prerender.js:
从ember导入Ember;
导出默认值Ember.Mixin.create({
willComplete:function(){
Ember.RSVP.resolve();
},
操作:{
didTransition:function(){
this._super();
var promises = [];
var currentHandlerInfos = this.router.get(' (var i = 0; i if(currentHandlerInfos [i] .handler.willComplete){
promises.push (currentHandlerInfos [i] .handler.willComplete());
}
}
Ember.RSVP.all(promises).then(window.prerenderReady); //< ; - FIRERING HERE
}
}
});
I am trying to create a pre-render server for my ember app.
I installed ember-prerender
(https://github.com/zipfworks/ember-prerender), used the initializers provided in the /example, deployed it on one of my servers.
But when I try to launch it:
Restarting renderer, timed out while initializing
This is the case even if I change engine (I tried with Phantom and jsdom).
My best guess is that the XContentReady
event is never fired.
So it was indeed XContentReady
not firering that was causing the problem.I didn't add the mixin that was triggering the event:
mixins/ember-prerender.js:
import Ember from 'ember';
export default Ember.Mixin.create({
willComplete: function() {
Ember.RSVP.resolve();
},
actions: {
didTransition: function() {
this._super();
var promises = [];
var currentHandlerInfos = this.router.get('router.currentHandlerInfos');
for (var i = 0; i < currentHandlerInfos.length; i++) {
if (currentHandlerInfos[i].handler.willComplete) {
promises.push(currentHandlerInfos[i].handler.willComplete());
}
}
Ember.RSVP.all(promises).then(window.prerenderReady); //<-- FIRERING HERE
}
}
});
这篇关于Ember预渲染:初始化时超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!