Ext.Loader Synchronously loading. Should I Ext.require() all my stores?

♀尐吖头ヾ 提交于 2019-12-12 04:24:30

问题


I have 20 Stores in my app. And i'm tunning & minifying my App with sencha build. While debugging I saw a lot of [Ext.Loader] Synchronously loading warnings:

[Ext.Loader] Synchronously loading 'MyApp.store.Store1'; consider adding Ext.require('MyApp.store.Store1') above Ext.onReady

My question is, should I include once all my stores with Ext.requires(['MyApp.store.Store1' ... StoreN]) before Ext.application({ .. }); or should I include only requires: ['MyApp.store.StoreX'] in the Class that uses that store.


回答1:


Stores should be placed in the stores configuration of Ext.app.Application or specific controllers.

Then they are not only loaded at the correct time but also registered with StoreManager, so that you can access them with controller.getStore(storeId).




回答2:


The only way I could manage to get rid of all the warnings without going through every file and analyze it's store dependencies, was to add Ext.require(['MyApp.store.Store1' ... 'StoreN'].

Stores are use widely in my App, thats why I thought that requiring them ONCE was better and more practical than requiring them in every file that uses them.

If you see any downsides in this approach please let me know!



来源:https://stackoverflow.com/questions/17160182/ext-loader-synchronously-loading-should-i-ext-require-all-my-stores

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