1 | (function(root) {
|
2 | root.$IMA = root.$IMA || {};
|
3 | root.$IMA.Runner = root.$IMA.Runner || {
|
4 | scripts: [],
|
5 | loadedScripts: [],
|
6 | load: function(script) {
|
7 | var runner = root.$IMA.Runner;
|
8 | runner.loadedScripts.push(script.src);
|
9 | if (runner.scripts.length === runner.loadedScripts.length) {
|
10 | if (typeof runner.onLoad === 'function') {
|
11 | runner.onLoad();
|
12 | }
|
13 | runner.run();
|
14 | }
|
15 | },
|
16 | run: function() {
|
17 | root.$IMA.Loader.initAllModules()
|
18 | .then(function() {
|
19 | return root.$IMA.Loader.import('app/main');
|
20 | })
|
21 | .catch(function(error) {
|
22 | var runner = root.$IMA.Runner;
|
23 | if (typeof runner.onError === 'function') {
|
24 | root.$IMA.Runner.onError(error);
|
25 | }
|
26 | console.error(error);
|
27 | });
|
28 | }
|
29 | };
|
30 | })(typeof window !== 'undefined' && window !== null ? window : global);
|