flush-timeouts
Override setTimeout and provide flushing capabilities
Last updated 6 years ago by efacilitation .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install flush-timeouts 
SYNC missed versions from official npm registry.

flush-timeout

Override setTimeout and provide flushing capabilities.

API

global.originalSetTimeout

This method is the original version of global.setTimeout. Use this if you want to register a not flushable timeout.

global.setTimeout

This method is the decorated version of global.setTimeout. It schedules the timeout for execution and also saves it in a collection so it can be flushed.

global.flushTimeouts(allowedCallStackSize)

This method synchronously executes all pending timeouts in the order they were registered. If a timeout registers another timeout it will be also executed after the others. Note: This method does not respect the provided delay interval.

Timeouts are often used to do asynchronous batch processing and regular background checks. Flushing timeouts synchronously for these kind of functions could result in infinite recursion. Therefore flushTimeouts() accepts an optional allowed call stack size to prevent too many recursive calls. If no value if is given the default allowed call stack size is used which is initially 10.

global.flushTimeouts.allowedCallStackSize

This property holds the default value for an allowed call stack size used by flushTimeouts().

Current Tags

  • 0.0.5                                ...           latest (6 years ago)

5 Versions

  • 0.0.5                                ...           6 years ago
  • 0.0.4                                ...           6 years ago
  • 0.0.3                                ...           6 years ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2017 © taobao.org |