| 1 |
if (!window.SequraFE) { |
| 2 |
window.SequraFE = {}; |
| 3 |
} |
| 4 |
|
| 5 |
(function () { |
| 6 |
function PageControllerFactory() { |
| 7 |
/** |
| 8 |
* Instantiates page controller; |
| 9 |
* |
| 10 |
* @param {string} controller |
| 11 |
* @param {Record<string, any>} configuration |
| 12 |
*/ |
| 13 |
this.getInstance = (controller, configuration) => { |
| 14 |
let parts = controller.split('-'); |
| 15 |
let name = ''; |
| 16 |
for (let part of parts) { |
| 17 |
part = part.charAt(0).toUpperCase() + part.slice(1); |
| 18 |
name += part; |
| 19 |
} |
| 20 |
|
| 21 |
name += 'Controller'; |
| 22 |
|
| 23 |
return SequraFE[name] ? new SequraFE[name](configuration) : null; |
| 24 |
}; |
| 25 |
} |
| 26 |
|
| 27 |
SequraFE.pageControllerFactory = new PageControllerFactory(); |
| 28 |
})(); |
| 29 |
|