@@ -347,7 +347,7 @@ module.exports = {
347
347
* The clearTimeout method cancels an instantiated Timer previously created
348
348
* by calling setTimeout.
349
349
*
350
- * @param {FastTimer } timeout
350
+ * @param {NodeJS.Timeout| FastTimer } timeout
351
351
*/
352
352
clearTimeout ( timeout ) {
353
353
// If the timeout is a FastTimer, call its own clear method.
@@ -362,6 +362,31 @@ module.exports = {
362
362
nativeClearTimeout ( timeout )
363
363
}
364
364
} ,
365
+ /**
366
+ * The setFastTimeout() method sets a fastTimer which executes a function once
367
+ * the timer expires.
368
+ * @param {Function } callback A function to be executed after the timer
369
+ * expires.
370
+ * @param {number } delay The time, in milliseconds that the timer should
371
+ * wait before the specified function or code is executed.
372
+ * @param {* } [arg] An optional argument to be passed to the callback function
373
+ * when the timer expires.
374
+ * @returns {FastTimer }
375
+ */
376
+ setFastTimeout ( callback , delay , arg ) {
377
+ // If the delay is less than or equal to the RESOLUTION_MS value return a
378
+ // native Node.js Timer instance.
379
+ return new FastTimer ( callback , delay , arg )
380
+ } ,
381
+ /**
382
+ * The clearTimeout method cancels an instantiated FastTimer previously
383
+ * created by calling setFastTimeout.
384
+ *
385
+ * @param {FastTimer } timeout
386
+ */
387
+ clearFastTimeout ( timeout ) {
388
+ timeout . clear ( )
389
+ } ,
365
390
/**
366
391
* The now method returns the value of the internal fast timer clock.
367
392
*
@@ -370,6 +395,13 @@ module.exports = {
370
395
now ( ) {
371
396
return fastNow
372
397
} ,
398
+ /**
399
+ * Trigger the onTick function to process the fastTimers array.
400
+ * Exported for testing purposes only.
401
+ */
402
+ tick ( ) {
403
+ onTick ( )
404
+ } ,
373
405
/**
374
406
* Exporting for testing purposes only.
375
407
* Marking as deprecated to discourage any use outside of testing.
0 commit comments