* notify all listeners when value is got
(key: EditorValueKey)
| 209 | * notify all listeners when value is got |
| 210 | */ |
| 211 | private notifyGot(key: EditorValueKey) { |
| 212 | let waits = this.waits.get(key) |
| 213 | if (!waits) { |
| 214 | return |
| 215 | } |
| 216 | waits = waits.slice().reverse() |
| 217 | let i = waits.length |
| 218 | while (i--) { |
| 219 | waits[i].resolve(this.get(key)) |
| 220 | if (waits[i].once) { |
| 221 | waits.splice(i, 1) |
| 222 | } |
| 223 | } |
| 224 | if (waits.length > 0) { |
| 225 | this.waits.set(key, waits) |
| 226 | } else { |
| 227 | this.waits.delete(key) |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | private setWait(key: EditorValueKey, resolve: (data: any) => void, once?: boolean) { |
| 232 | const waits = this.waits.get(key) |