call-once-after-tick

1.0.2 • Public • Published

call-once-after-tick

Enables multiple call-sites to enqueue a function call that will occur both asynchronously and only once per tick.

Install

npm install --save call-once-after-tick

Example

import callOnceAfterTick from 'call-once-after-tick';

let count = 0;
const fn = callOnceAfterTick(() => count++);

console.log(count); // 0

fn();
fn();
fn();

console.log(count); // 0

process.nextTick(() => {
  console.log(count); // 1
});

Readme

Keywords

none

Package Sidebar

Install

npm i call-once-after-tick

Weekly Downloads

0

Version

1.0.2

License

MIT

Last publish

Collaborators

  • markfinger