All files / ima/polyfill imaRunner.js

33.33% Statements 3/9
50% Branches 5/10
20% Functions 1/5
33.33% Lines 3/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2431x 31x 31x                                          
(function(root) {
  root.$IMA = root.$IMA || {};
  root.$IMA.Runner = root.$IMA.Runner || {
    scripts: [],
    loadedScripts: [],
    load: function(script) {
      this.loadedScripts.push(script.src);
      if (this.scripts.length === this.loadedScripts.length) {
        this.run();
      }
    },
    run: function() {
      root.$IMA.Loader
        .initAllModules()
        .then(function() {
          return root.$IMA.Loader.import('app/main');
        })
        .catch(function(error) {
          console.error(error);
        });
    }
  };
})(typeof window !== 'undefined' && window !== null ? window : global);