问题
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.
回答1:
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
}
}
});
来源:https://stackoverflow.com/questions/33547516/ember-pre-render-timed-out-while-initializing