()
| 533 | // slot(output); |
| 534 | // |
| 535 | _claimOutputSlot(): (payload?: Dap.OutputEventParams) => void { |
| 536 | // TODO: should we serialize output between threads? For example, it may be important |
| 537 | // when using postMessage between page a worker. |
| 538 | const slot = this._serializedOutput; |
| 539 | const deferred = getDeferred<void>(); |
| 540 | const result = async (payload?: Dap.OutputEventParams) => { |
| 541 | await slot; |
| 542 | if (payload) { |
| 543 | const isClearConsole = payload.output === '\x1b[2J'; |
| 544 | const noop = isClearConsole && !this._consoleIsDirty; |
| 545 | if (!noop) { |
| 546 | this._dap.with(dap => dap.output(payload)); |
| 547 | this._consoleIsDirty = !isClearConsole; |
| 548 | } |
| 549 | } |
| 550 | deferred.resolve(); |
| 551 | }; |
| 552 | |
| 553 | this._serializedOutput = slot.then(() => deferred.promise); |
| 554 | // Timeout to avoid blocking future slots if this one does stall. |
| 555 | setTimeout(deferred.resolve, this._sourceContainer.sourceMapTimeouts().output); |
| 556 | |
| 557 | return result; |
| 558 | } |
| 559 | |
| 560 | async _pauseOnScheduledAsyncCall(): Promise<void> { |
| 561 | if (!scheduledPauseOnAsyncCall) return; |
no test coverage detected