• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3
4// This test makes sure that timers created with setTimeout can be disarmed by
5// clearInterval and that timers created with setInterval can be disarmed by
6// clearTimeout.
7//
8// This behavior is documented in the HTML Living Standard:
9//
10// * Refs: https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval
11
12// Disarm interval with clearTimeout.
13const interval = setInterval(common.mustNotCall(), 1);
14clearTimeout(interval);
15
16// Disarm timeout with clearInterval.
17const timeout = setTimeout(common.mustNotCall(), 1);
18clearInterval(timeout);
19