* initAsync * Called after all core objects have been constructed. * @return {Promise} Promise resolved when this component has completed initialization
()
| 59 | * @return {Promise} Promise resolved when this component has completed initialization |
| 60 | */ |
| 61 | initAsync() { |
| 62 | for (const id of this.dependencies) { |
| 63 | if (!this.context.systems[id]) { |
| 64 | return Promise.reject(`Cannot init: ${this.id} requires ${id}`); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | const context = this.context; |
| 69 | const l10n = context.systems.l10n; |
| 70 | const urlhash = context.systems.urlhash; |
| 71 | |
| 72 | const prerequisites = Promise.all([ |
| 73 | l10n.initAsync(), |
| 74 | urlhash.initAsync() |
| 75 | ]); |
| 76 | |
| 77 | return this._initPromise = prerequisites |
| 78 | .then(() => { |
| 79 | // Setup event handlers.. |
| 80 | urlhash.on('hashchange', this._hashchange); |
| 81 | l10n.on('localechange', this._setupKeybinding); |
| 82 | this._setupKeybinding(); |
| 83 | }); |
| 84 | } |
| 85 | |
| 86 | |
| 87 | /** |
nothing calls this directly
no test coverage detected