Hello!,
I’m looking a way to execute JavaScript code after Discourse has finished loading. I’m using the following approach as I’ve seen it some plugins.
// Inside an initializer
export default {
name: 'my-initializer',
initialize(container) {
withPluginApi('0.8.9', api => {
api.modifyClass('component:site-header', {
@on('didInsertElement')
myInitializer() {
Ember.run.scheduleOnce('afterRender', () => {
// my code here
});
},
});
});
},
};
Is there a way to do specifically this, without hooking to the site-header component lifecycle? Like a window.onload
but for Discourse.
Thanks!