* Load modules via ajax request and create module objects. * @param {object} module Information about the module we want to load. * @returns {Promise } resolved when module is loaded
(module)
| 142 | * @returns {Promise<void>} resolved when module is loaded |
| 143 | */ |
| 144 | async function loadModule (module) { |
| 145 | const url = module.path + module.file; |
| 146 | |
| 147 | /** |
| 148 | * @returns {Promise<void>} |
| 149 | */ |
| 150 | async function afterLoad () { |
| 151 | const moduleObject = Module.create(module.name); |
| 152 | if (moduleObject) { |
| 153 | await bootstrapModule(module, moduleObject); |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | if (loadedModuleFiles.indexOf(url) !== -1) { |
| 158 | await afterLoad(); |
| 159 | } else { |
| 160 | await loadFile(url); |
| 161 | loadedModuleFiles.push(url); |
| 162 | await afterLoad(); |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * Bootstrap modules by setting the module data and loading the scripts & styles. |
no test coverage detected