{"id":45151,"library":"interval-queue","title":"interval-queue","description":"interval-queue is a lightweight Node.js utility library (v1.0.4) for managing periodic task execution. It provides a simple API to create, delete, and clear intervals with time units in milliseconds, seconds, minutes, or hours. Unlike raw setInterval, it offers centralized management and typed return values. Actively maintained with TypeScript types included. Suitable for scheduling repeated tasks in server-side applications.","status":"active","version":"1.0.4","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install interval-queue","lang":"bash","label":"npm"},{"cmd":"yarn add interval-queue","lang":"bash","label":"yarn"},{"cmd":"pnpm add interval-queue","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package uses named exports; default import is not available.","wrong":"import createInterval from 'interval-queue'","symbol":"createInterval","correct":"import { createInterval } from 'interval-queue'"},{"note":"Package is ESM-only; CommonJS require returns undefined.","wrong":"const { deleteInterval } = require('interval-queue')","symbol":"deleteInterval","correct":"import { deleteInterval } from 'interval-queue'"},{"note":"Convenience function that takes seconds instead of milliseconds.","wrong":null,"symbol":"createIntervalSecond","correct":"import { createIntervalSecond } from 'interval-queue'"},{"note":"Stops all intervals managed by the package.","wrong":null,"symbol":"clearIntervals","correct":"import { clearIntervals } from 'interval-queue'"}],"quickstart":{"code":"import { createInterval, deleteInterval, clearIntervals } from 'interval-queue';\n\n// Create an interval that runs every 2 seconds\nconst interval = createInterval(() => {\n  console.log('Task executed');\n}, 2000);\n\n// Delete a specific interval after 10 seconds\nsetTimeout(() => {\n  deleteInterval(interval);\n  console.log('Interval deleted');\n}, 10000);\n\n// Clear all intervals after 15 seconds\nsetTimeout(() => {\n  clearIntervals();\n  console.log('All intervals cleared');\n}, 15000);\n","lang":"typescript","description":"Creates a 2-second interval, deletes it after 10 seconds, and clears all intervals after 15 seconds."},"warnings":[{"fix":"Use named imports like `import { createInterval } from 'interval-queue'`.","message":"The package uses named exports only; default import or require() will fail.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Call clearIntervals() before process exit or in cleanup hooks (e.g., process.on('exit', clearIntervals)).","message":"Intervals are not automatically cleaned up when the process exits; you must call clearIntervals() to avoid hanging.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Store the return value of createInterval and pass it to deleteInterval.","message":"The deleteInterval function expects the return value of createInterval, not a number or string.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"N/A","message":"No deprecation warnings in this version.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'activ':50 'api':23 'applic':65 'central':44 'clear':28 'creat':25 'delet':26 'execut':18 'hour':38 'includ':55 'interv':2,5,29 'interval-queu':1,4 'javascript':66 'librari':12 'lightweight':9 'maintain':51 'manag':15,45 'millisecond':34 'minut':36 'node.js':10 'offer':43 'period':16 'provid':20 'queue':3,6 'raw':40 'repeat':59 'return':48 'schedul':58 'second':35 'server':63 'server-sid':62 'setinterv':41 'side':64 'simpl':22 'suitabl':56 'task':17,60 'time':31 'type':47,54 'typescript':53,67 'unit':32 'unlik':39 'util':11 'v1.0.4':13 'valu':49","created_at":"2026-06-07T12:53:37.375088+00:00","updated_at":"2026-06-07T12:53:37.375088+00:00","problems":[{"fix":"Replace `import createInterval from 'interval-queue'` with `import { createInterval } from 'interval-queue'`.","cause":"Default import used instead of named import.","error":"TypeError: createInterval is not a function"},{"fix":"Change to ES module import or use destructuring: `const { deleteInterval } = require('interval-queue')` does not work; switch to `import { deleteInterval } from 'interval-queue'`.","cause":"Using CommonJS require() which returns undefined for named exports.","error":"ReferenceError: deleteInterval is not defined"},{"fix":"Ensure you pass the exact object returned by createInterval (or createIntervalSecond, etc.).","cause":"Passing an invalid value (e.g., a number, string) to deleteInterval.","error":"Error: loop is not an interval object"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"interval-queue","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}