ember.jsember-engines

How to pre load ember engines?


Am using ember-engines in my project, After user lands in host ember application, I want my other ember engines to preload (say after 10 seconds), so that when user navigates to other tabs, there wont be any lag in UI.. i dont want to disable lazyLoading of my ember engines since that will increase the size of vendor js and css of host app during initial load.. Any reference for this is appreciated (I was not able to find any example or reference for this).


Solution

  • We can use loadBundle method of asset-loader service included by ember-engine as follow:

    assetLoader: service(),
    
    preloadEngine() {
      this.assetLoader.loadBundle('<name of the engine>');
    }
    

    The loadBundle method return a promise and resolves when the engine bundle loads successfully.