-
-
Couldn't load subscription status.
- Fork 260
DetachedWindowAPI.waitUntilComplete()
Waits for all ongoing operations to complete. This includes operations such as loading resources and executing scripts.
async waitUntilComplete(): Promise<void>;Promise<void>
Set settings.debug.traceWaitUntilComplete to a time in ms to collect which tasks that are still open and their stack traces.
Read more about this under IOptionalBrowserSettings.
This method may get stuck when using intervals or timers in a loop. Long running timers or fetch requests will slow it down, as it will wait for them to complete.
You can use the settings timer.maxTimeout, timer.maxIntervalTime, timer.maxIntervalIterations and timer.preventTimerLoops to prevent this from happening with timers.
Read more about this under IOptionalBrowserSettings.
import { Window } from 'happy-dom';
const window = new Window({
settings: {
timer: {
maxTimeout: 200,
maxIntervalTime: 10,
maxIntervalIterations: 1,
preventTimerLoops: true
}
}
});
// Waits for async tasks to complete
await window.happyDOM.waitUntilComplete();
Help Packages