Registry / devops / queue-tick

queue-tick

JSON →
library1.0.1jsnpmunverified

queue-tick v1.0.1 is a minimal shim that schedules a callback on the next tick, preferring process.nextTick in Node.js (for broader compatibility) and falling back to queueMicrotask in browsers. It's stable, has no dependencies, and is ideal for micro-libraries needing a reliable nextTick across environments without polyfills. Last updated in 2022; release cadence is low as it's feature-complete.

npm install queue-tick
INSTALL
IMPORT
SIG · QUEUE-TICK
Q
queue-tick
devopsjavascriptv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

queueTick
import queueTick from 'queue-tick'
import { queueTick } from 'queue-tick'
Default export only; named import will give undefined.
queueTick
const queueTick = require('queue-tick')
const { queueTick } = require('queue-tick')
CommonJS default import, no destructuring.
queueTick
const queueTick = require('queue-tick')
import * as queueTick from 'queue-tick'
Namespace import not supported; use default import.

Demonstrates scheduling a callback on the next tick using queue-tick, showing that the callback executes after the current synchronous code.

const queueTick = require('queue-tick'); queueTick(() => { console.log('This runs on the next tick'); }); console.log('This runs first'); // Output: // This runs first // This runs on the next tick
Debug
Known issues
gotchaqueue-tick does not accept arguments to the callback; unlike process.nextTick which passes arguments.
fix
Wrap your callback in an anonymous function to pass arguments: queueTick(() => myCallback(arg1, arg2))
affects: >=1.0.0
gotchaqueue-tick may not work in older browsers that lack queueMicrotask; the package requires queueMicrotask or falls back to no-op? (No fallback documented).
fix
Use a polyfill for queueMicrotask in browsers that don't support it, or use process.nextTick polyfill with setImmediate/setTimeout.
affects: >=1.0.0
gotchaqueue-tick does not return anything; unlike process.nextTick which returns a timeout object for cancellation.
fix
If cancellation is needed, use process.nextTick directly or a different scheduler.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: queue_tick_1.default is not a function
Using named import import { queueTick } from 'queue-tick' in ESM context.
fix
Use default import: import queueTick from 'queue-tick'
queueTick is not defined
Attempting to use queueTick in a browser that does not support queueMicrotask and where process.nextTick is undefined.
fix
Ensure the environment supports queueMicrotask (modern browsers) or use a polyfill.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
queue-tick — npm install queue-tick · libregistry