-
Notifications
You must be signed in to change notification settings - Fork 14
/
clear.js.html
84 lines (64 loc) · 2.55 KB
/
clear.js.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: clear.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: clear.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* Copyright (c) 2019-2021 Emilio Almansi. All rights reserved.
* This work is licensed under the terms of the MIT license.
* For a copy, see the file LICENSE in the root directory.
*/
import { validateTimer } from './validation'
/**
* Stops an execution cycle started by setIntervalAsync.<br>
* Any ongoing function executions will run until completion,
* but all future ones will be cancelled.
*
* @param {SetIntervalAsyncTimer} timer
* @returns {Promise}
* A promise which resolves when all pending executions have finished.
*/
export async function clearIntervalAsync (timer) {
validateTimer(timer)
timer.stopped = true
for (const iterationId in timer.timeouts) {
clearTimeout(timer.timeouts[iterationId])
delete timer.timeouts[iterationId]
}
for (const iterationId in timer.promises) {
try {
await timer.promises[iterationId]
} catch (_) {
// Do nothing.
}
delete timer.promises[iterationId]
}
}
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="SetIntervalAsyncError.html">SetIntervalAsyncError</a></li><li><a href="SetIntervalAsyncTimer.html">SetIntervalAsyncTimer</a></li></ul><h3>Global</h3><ul><li><a href="global.html#%255BDynamic%255DsetIntervalAsync">[Dynamic] setIntervalAsync</a></li><li><a href="global.html#%255BFixed%255DsetIntervalAsync">[Fixed] setIntervalAsync</a></li><li><a href="global.html#%255BLegacy%255DsetIntervalAsync">[Legacy] setIntervalAsync</a></li><li><a href="global.html#clearIntervalAsync">clearIntervalAsync</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Mon Mar 29 2021 15:54:53 GMT+0200 (Central European Summer Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>