项目作者: sagiegurari

项目描述 :
Defer function calls to the start of the next cycle.
高级语言: JavaScript
项目地址: git://github.com/sagiegurari/node-later.git
创建时间: 2017-04-28T14:08:50Z
项目社区:https://github.com/sagiegurari/node-later

开源协议:Apache License 2.0

下载


node-later

NPM Version CI Coverage Status Known Vulnerabilities Inline docs License Total Downloads

Defer function calls to the start of the next cycle.

Overview

Invoke functions in the next cycle.

You have multiple node.js APIs to run a function later, for example process.nextTick, setImmediate and setTimeout.

Each of those will invoke the provided function at a different time.

This library enables to extract the “best” API which enables to run a provided function as soon as possible based on the currently node.js runtime version.

Usage

  1. //first you must require this library as follows:
  2. var later = require('node-later');
  3. //get a defer function based on current node.js version
  4. var defer = later();
  5. //or get a defer function based on a specific node.js version
  6. defer = later('0.10.0'); //let be compatible with node.js 0.10 regardless of our current node.js runtime
  7. //or get a defer function which is IO safe (will prevent stack overflow errors)
  8. defer = later(true);
  9. //use defer function
  10. defer(onCallback() {
  11. //do something
  12. });

Installation

In order to use this library, just run the following npm install command:

  1. npm install --save node-later

API Documentation

See full docs at: API Docs

Contributing

See contributing guide

Release History

Date Version Description
2020-05-11 v2.0.0 Migrate to github actions and upgrade minimal node version
2019-12-16 v1.0.16 Maintenance
2017-04-28 v1.0.0 Offical release
2017-04-28 v0.0.1 Initial release

License

Developed by Sagie Gur-Ari and licensed under the Apache 2 open source license.