Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/webappapis/timers/clearinterval-from-callback.any.html - WPT Dashboard Interop Dashboard
- /html/webappapis/timers/clearinterval-from-callback.any.worker.html - WPT Dashboard Interop Dashboard
async_test((t) => {
let wasPreviouslyCalled = false;
const handle = setInterval(
t.step_func(() => {
if (!wasPreviouslyCalled) {
wasPreviouslyCalled = true;
clearInterval(handle);
// Make the test succeed after the callback would've run next.
setInterval(t.step_func_done(), 750);
} else {
assert_unreached();
}
}),
500
);
}, "Clearing an interval from the callback should still clear it.");