Registry / devops / command-queue-module

command-queue-module

JSON →
library1.0.0jsnpmunverified

A lightweight utility (v1.0.0, stable) for creating proxy modules that queue method calls before the actual module is loaded. Unlike heavier alternatives like lazy-async (20x larger), it focuses on minimal size and a simple API. The proxy mirrors the original API exactly; queued commands replay in order once the real implementation arrives. Ideal for deferring non-critical libraries (e.g., analytics) while still collecting calls early.

npm install command-queue-module
INSTALL
IMPORT
SIG · COMMAND-QUEUE-MODU
C
command-queue-module
devopsjavascriptv1.0.0
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.

createCommandQueueModule
import createCommandQueueModule from 'command-queue-module'
const { createCommandQueueModule } = require('command-queue-module')
Default export only; named destructuring from require() returns undefined.
createCommandQueueModule
const createCommandQueueModule = require('command-queue-module')
const { createCommandQueueModule } = require('command-queue-module')
CommonJS: use default assignment, not destructuring.
createCommandQueueModule
import createCommandQueueModule from 'command-queue-module'
import { createCommandQueueModule } from 'command-queue-module'
ESM: default import, not named import.

Creates a proxy for a module with two methods; calls are queued and replayed once the real module loads after 1 second.

import createCommandQueueModule from 'command-queue-module'; const api = createCommandQueueModule(['log', 'error'], (onLoad) => { const realModule = { log: (msg) => console.log('LOG:', msg), error: (msg) => console.error('ERROR:', msg), }; setTimeout(() => onLoad(realModule), 1000); }); api.log('queued call'); api.error('queued error'); // After 1 second, both calls are invoked on realModule.
Debug
Known issues
deprecatedThe package is no longer maintained; consider using a more modern alternative or native dynamic imports.
fix
Switch to lazy-async or implement your own queue with ES6 Proxies.
affects: >=1.0.0
gotchaMethod names must be passed as strings; the proxy only exposes these methods. Unknown properties will return undefined.
fix
Ensure all needed method names are listed in the array.
affects: >=0.0.0
gotchaThe loadCallback is invoked synchronously; if onLoad is never called, queued commands are lost.
fix
Always call onLoad with the real module; handle errors to prevent orphans.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: createCommandQueueModule is not a function
Using named import instead of default import in ESM.
fix
Use `import createCommandQueueModule from 'command-queue-module'`
Cannot read property 'trackEvent' of undefined
Required as object destructuring in CommonJS.
fix
Use `const createCommandQueueModule = require('command-queue-module')`
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

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