* Flushes any pending scripts synchronously. * Call this before emitting onSerializationFinished to ensure all scripts are injected. * * IMPORTANT: Only injects if the barrier has been lifted. Before the barrier is lifted, * scripts should remain in the queue so takeBufferedScripts() can
()
| 111 | * scripts should remain in the queue so takeBufferedScripts() can retrieve them |
| 112 | */ |
| 113 | flush() { |
| 114 | if (!this._scriptBarrierLifted) return |
| 115 | if (this._cleanedUp) return |
| 116 | this._pendingMicrotask = false |
| 117 | const scriptsToInject = this.takeAll() |
| 118 | if (scriptsToInject && this.router?.serverSsr) { |
| 119 | this.router.serverSsr.injectScript(scriptsToInject) |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | takeAll() { |
| 124 | const bufferedScripts = this._queue |
no test coverage detected