Ember pre-render: timed out while initializing

狂风中的少年 提交于 2019-12-25 06:01:41

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!