( context: QuickJSContext, runtime: QuickJSRuntime, deadlineMs: number, timeoutMs: number, )
| 306 | }); |
| 307 | |
| 308 | const drainJobs = ( |
| 309 | context: QuickJSContext, |
| 310 | runtime: QuickJSRuntime, |
| 311 | deadlineMs: number, |
| 312 | timeoutMs: number, |
| 313 | ): void => { |
| 314 | while (runtime.hasPendingJob()) { |
| 315 | if (Date.now() >= deadlineMs) { |
| 316 | throw new Error(timeoutMessage(timeoutMs)); |
| 317 | } |
| 318 | |
| 319 | const pending = runtime.executePendingJobs(); |
| 320 | if (pending.error) { |
| 321 | const error = context.dump(pending.error); |
| 322 | pending.error.dispose(); |
| 323 | throw toError(error); |
| 324 | } |
| 325 | } |
| 326 | }; |
| 327 | |
| 328 | const waitForDeferreds = async ( |
| 329 | pendingDeferreds: ReadonlySet<QuickJSDeferredPromise>, |
no test coverage detected