Hi, all.
Is there way to load js files in asynchronous manner? I want implement module structure in my application.
I know that there is FileLoader.loadJSFiles method. But I don't know how use it properly.
For example I have init.js
and two component classes: AAA and BBB. Coponent AAA depends on component BBB.
AAA.js
BBB.js
Now, when I run this mini application I see following console output and error:
I know why the error occur and I understand how it works.
But I don't know how avoid this error and implement asynchronous loading properly.
Is there way to load js files in asynchronous manner? I want implement module structure in my application.
I know that there is FileLoader.loadJSFiles method. But I don't know how use it properly.
For example I have init.js
Code:
isc.FileLoader.loadJSFiles([ 'js/AAA.js' ], function() {
console.info('create AAA')
AAA.create();
});AAA.js
Code:
isc.FileLoader.loadJSFiles([ 'js/BBB.js' ]);
console.info('define AAA');
isc.defineClass('AAA', 'HLayout').addProperties({
initWidget : function() {
console.info('create BBB');
this.addMembers([ BBB.create() ])
}
});Code:
console.info('define BBB');
isc.defineClass('BBB', 'HLayout').addProperties({
});Code:
define AAA
create AAA
create BBB
ReferenceError: BBB is not defined
define BBBBut I don't know how avoid this error and implement asynchronous loading properly.