A micro-package (~20 lines) that generates a push function for a global queue array (e.g., window._analytics). Version 1.0.1 is stable; no regular releases. Designed for 3rd-party analytics/tracking snippets where standard async patterns (like promises or event emitters) aren't available. Unlike bespoke queue implementations, it ensures the queue array exists and pushes raw arguments (or wrapped arrays) onto it. Intended for browser use only—no Node.js environment considered. Minimal footprint, no dependencies, and trivial API (one exported function).
npm install global-queueNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a push function for window._analytics and pushes two calls; shows resulting queue structure.
Use only in browser contexts; wrap in feature check: if (typeof window !== 'undefined') { ... }.Pass { wrap: false } as second argument to keep arguments unwrapped: const push = require('global-queue')('_analytics', { wrap: false });Ensure no other script creates the queue before calling global-queue, or manually clear it: window._analytics = [];
Wrap in a browser check: if (typeof window !== 'undefined') { const push = require('global-queue')('_analytics'); }Correct usage: const push = require('global-queue')('_myQueue');No dependency data recorded yet.