PDA

View Full Version : How to aviod warning "synchronized loading"



hudi1
4 Jun 2013, 1:03 AM
in my controler I have init function:

init : function() {

Ext.create("SimpleWeb.view.person.Search");
Ext.create("SimpleWeb.view.person.Edit");
Ext.create("SimpleWeb.view.person.Add");
Ext.create("SimpleWeb.view.person.Delete");
Ext.create("SimpleWeb.view.contact.Add");
Ext.create("SimpleWeb.view.contact.Edit");
Ext.create("SimpleWeb.view.contact.Delete");
...

this cause warining: Synchronously loading 'SimpleWeb.view.contact.Add'

How I can avoid this warning ? I need at start application inicialized all window and then just call them: Ext.getCmp("PersonSearch").show();

evant
4 Jun 2013, 3:27 AM
To prevent the warning, you need to use either:

a) requires (on other classes)
b) If you're using MVC, views on the app/controller.

hudi1
4 Jun 2013, 3:45 AM
I already try it but when I use:
requires : [ 'SimpleWeb.view.person.Search' ] in my main panel instead of:
//Ext.create("SimpleWeb.view.person.Search"); in controler then
Ext.getCmp("PersonSearch") return undefined. Same with view in app.js

evant
4 Jun 2013, 4:04 AM
When you use Ext.create(), it will go and load the JS file if it's not yet loaded. By putting it in the requires, you're saying that you'll need it at some point.

You still need to use Ext.create('MyClass') or new MyClass(), even if you've required it.

hudi1
4 Jun 2013, 4:12 AM
ok thx that you deny your first answer now please answer to my question: How should I inicialized all components at startup without these warning

evant
4 Jun 2013, 4:22 AM
The answer is the same. You need to require() them before you use them to prevent the warning.

hudi1
4 Jun 2013, 4:34 AM
hm ok so I need to add requied and warning dissapear. Now is loading application faster ?