| Total Complexity | 7 |
| Total Lines | 19 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | const providers = {} |
||
| 13 | class ExternalScriptLoader { |
||
| 14 | constructor () { |
||
| 15 | if (!instance) { |
||
| 16 | instance = this |
||
| 17 | } |
||
| 18 | return instance |
||
|
|
|||
| 19 | } |
||
| 20 | |||
| 21 | static getInstance () { |
||
| 22 | return instance || new ExternalScriptLoader() |
||
| 23 | } |
||
| 24 | |||
| 25 | initialize (type, options = {}) { |
||
| 26 | if (!this[type]) { |
||
| 27 | this[type] = providers[type](options) |
||
| 28 | } |
||
| 29 | return this[type] |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 34 |