time-to-botec/squiggle/node_modules/@stdlib/utils/next-tick/README.md
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

1.5 KiB

nextTick

Add a callback to the "next tick queue".

Usage

var nextTick = require( '@stdlib/utils/next-tick' );

nextTick( clbk[, ...args] )

Adds a callback to the "next tick queue".

function beep() {
    console.log( 'boop' );
}

nextTick( beep );

Notes

  • The queue is fully drained after the current operation on the JavaScript stack runs to completion and before the event loop is allowed to continue.
  • Creating an infinite loop is possible if nextTick is called recursively.

Examples

var nextTick = require( '@stdlib/utils/next-tick' );

function beep( x, y, z ) {
    console.log( 'boop: %d %d %d', x, y, z );
}

nextTick( beep, 1, 2, 3 );