Commit 987e0cb
timers: allow timers to be used as primitives
This allows timers to be matched to numeric Ids and therefore used
as keys of an Object, passed and stored without storing the Timer instance.
clearTimeout/clearInterval is modified to support numeric/string Ids.
Co-authored-by: Bradley Farias <bradley.meck@gmail.com>
Co-authored-by: Anatoli Papirovski <apapirovski@mac.com>
Refs: #21152
Backport-PR-URL: #34482
PR-URL: #34017
Backport-PR-URL: #34482
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Signed-off-by: Denys Otrishko <shishugi@gmail.com>1 parent 14d4bfa commit 987e0cbCopy full SHA for 987e0cb
File tree
Expand file treeCollapse file tree
4 files changed
+77
-0
lines changedOpen diff view settings
Filter options
- doc/api
- lib
- internal
- test/parallel
Expand file treeCollapse file tree
4 files changed
+77
-0
lines changedOpen diff view settings
Collapse file
+16Lines changed: 16 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
125 | 125 | |
126 | 126 | |
127 | 127 | |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + |
128 | 143 | |
129 | 144 | |
130 | 145 | |
| ||
274 | 289 | |
275 | 290 | |
276 | 291 | |
| 292 | + |
Collapse file
+4Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
103 | 103 | |
104 | 104 | |
105 | 105 | |
| 106 | + |
| 107 | + |
106 | 108 | |
107 | 109 | |
108 | 110 | |
| ||
182 | 184 | |
183 | 185 | |
184 | 186 | |
| 187 | + |
185 | 188 | |
186 | 189 | |
187 | 190 | |
| ||
595 | 598 | |
596 | 599 | |
597 | 600 | |
| 601 | + |
598 | 602 | |
599 | 603 | |
600 | 604 | |
|
Collapse file
+28Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
22 | 22 | |
23 | 23 | |
24 | 24 | |
| 25 | + |
25 | 26 | |
26 | 27 | |
| 28 | + |
27 | 29 | |
28 | 30 | |
29 | 31 | |
| ||
40 | 42 | |
41 | 43 | |
42 | 44 | |
| 45 | + |
43 | 46 | |
44 | 47 | |
45 | 48 | |
| ||
62 | 65 | |
63 | 66 | |
64 | 67 | |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
65 | 73 | |
66 | 74 | |
67 | 75 | |
68 | 76 | |
69 | 77 | |
70 | 78 | |
71 | 79 | |
| 80 | + |
| 81 | + |
| 82 | + |
72 | 83 | |
73 | 84 | |
74 | 85 | |
| ||
159 | 170 | |
160 | 171 | |
161 | 172 | |
| 173 | + |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | + |
| 178 | + |
| 179 | + |
| 180 | + |
162 | 181 | |
163 | 182 | |
164 | 183 | |
| ||
204 | 223 | |
205 | 224 | |
206 | 225 | |
| 226 | + |
| 227 | + |
| 228 | + |
| 229 | + |
| 230 | + |
| 231 | + |
| 232 | + |
| 233 | + |
| 234 | + |
207 | 235 | |
208 | 236 | |
209 | 237 | |
|
Collapse file
test/parallel/test-timers-to-primitive.js
Copy file name to clipboard+29Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 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 | + |
0 commit comments