* startAsync * Called after all core objects have been initialized. * @return {Promise} Promise resolved when this component has completed startup
()
| 106 | * @return {Promise} Promise resolved when this component has completed startup |
| 107 | */ |
| 108 | startAsync() { |
| 109 | if (this._startPromise) return this._startPromise; |
| 110 | |
| 111 | const context = this.context; |
| 112 | const imagery = context.systems.imagery; |
| 113 | const editor = context.systems.editor; |
| 114 | const l10n = context.systems.l10n; |
| 115 | const photos = context.systems.photos; |
| 116 | const rapid = context.systems.rapid; |
| 117 | const map = context.systems.map; |
| 118 | const ui = context.systems.ui; |
| 119 | |
| 120 | const prerequisites = Promise.all([ |
| 121 | imagery.startAsync(), |
| 122 | editor.startAsync(), |
| 123 | l10n.startAsync(), |
| 124 | map.startAsync(), |
| 125 | photos.startAsync(), |
| 126 | rapid.startAsync(), |
| 127 | ui.startAsync() |
| 128 | ]); |
| 129 | |
| 130 | return this._startPromise = prerequisites |
| 131 | .then(() => { |
| 132 | // Register event handlers here |
| 133 | editor.on('stablechange', this.deferredUpdateTitle); |
| 134 | context.on('modechange', this.deferredUpdateTitle); |
| 135 | window.addEventListener('hashchange', this._hashchange); |
| 136 | |
| 137 | this._started = true; |
| 138 | this.resume(); // Emits 'hashchange' |
| 139 | }); |
| 140 | } |
| 141 | |
| 142 | |
| 143 | /** |