* Returns a promise that resolves when this node has reached at least the * given state in the lifecycle.
(state: TargetState)
| 656 | * given state in the lifecycle. |
| 657 | */ |
| 658 | public async waitUntil(state: TargetState) { |
| 659 | if (this._state >= state) { |
| 660 | return Promise.resolve(); |
| 661 | } |
| 662 | |
| 663 | return new Promise<void>(resolve => { |
| 664 | const l = this._stateChangeEmitter.event(s => { |
| 665 | if (s >= state) { |
| 666 | l.dispose(); |
| 667 | resolve(); |
| 668 | } |
| 669 | }); |
| 670 | }); |
| 671 | } |
| 672 | |
| 673 | /** |
| 674 | * Returns a promise that resolves when all children this node have reached |