Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ext.syncRequire() loading files recursively?

I want to require all the files after login. In my controller I have views:[...views...], stores: [...stores...] and models:[...models...].

My expectation was, if I Ext.syncRequire('MyApp.controller.MyController'); that it will load views, stores and models inside that controller as well but my console says that it's loading views, stores and models synchronously.

If I put Ext.syncRequire([controller, views, stores, models]); I don't get the warning message again.

My question is, how can I load just the controller (synchronously) and I would get everything specified in the controller loaded as well (specified stores, models, views)?

like image 303
NullCod3 Avatar asked May 11 '26 15:05

NullCod3


1 Answers

That would only happen with dependencies defined in the requires array cause that is the only one the loader knows.

views, models and stores are only handled by the application class, meaning by a controller which get invoked by using the application instance. If you require a controller yourself there is nothing that will resolve these custom dependencies.

Here is a way how it can be done:

  • Get the 'finish loading' callback to fetch the controller config from the classmanager.
  • Build a new require list from the views,stores and models array.
  • Load it and create the controller instance within the finish loading callback of this request.
like image 118
sra Avatar answered May 15 '26 17:05

sra



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!