简体   繁体   English

如何预加载 ember 引擎?

[英]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).我在我的项目中使用ember 引擎,在用户登陆主机 ember 应用程序后,我希望我的其他 ember 引擎预加载(比如 10 秒后),这样当用户导航到其他选项卡时,UI 中不会有任何延迟。我不想禁用我的 ember 引擎的lazyLoading,因为这会在初始加载期间增加主机应用程序的供应商 js 和 css 的大小。任何对此的参考表示赞赏(我无法找到任何示例或参考)。

We can use loadBundle method of asset-loader service included by ember-engine as follow:我们可以使用ember-engine包含的asset-loader服务的loadBundle方法如下:

assetLoader: service(),

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

The loadBundle method return a promise and resolves when the engine bundle loads successfully. loadBundle方法返回 promise并在引擎包加载成功时解析。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM