Hmm, I think I would go at it a bit differently. Instead of doing work during destroy, I would probably implement a custom visit and do the work after calling _super.
// app/app.js
export default Application.extend({
// ...snip...
visit() {
return this._super(...arguments).finally(results => {
// visit has finished, results is the final HTML to be rendered by fastboot
});
}
});
Also, it sounds like maybe you are looking for something similar to the Shoebox API’s? There is fairly deep integration (between ember-cli-fastboot and fastboot itself) that enables this to work well…
Oh, I think I made a mistake in my snippet, I think visit is a static method on Ember.Application subclasses.
You’d need to tweak to:
const App = Application.extend({ /* normal stuff here */ });
App.reopenClass({
visit() {
return this._super(...arguments).finally(results => {
// visit has finished, results is the final HTML to be rendered by fastboot
});
}
});