{"name":"worker-timers-broker","version":"7.1.8","author":{"name":"Christoph Guttandin"},"license":"MIT","_id":"worker-timers-broker@7.1.8","maintainers":[{"name":"chrisguttandin","email":"chrisguttandin@media-codings.com"}],"homepage":"https://github.com/chrisguttandin/worker-timers-broker","bugs":{"url":"https://github.com/chrisguttandin/worker-timers-broker/issues"},"dist":{"shasum":"28bdb231473068b39084acc79ffcf98fe22ce9da","tarball":"http://registry-npm.ywwl.com/worker-timers-broker/download/worker-timers-broker-7.1.8.tgz","fileCount":20,"integrity":"sha512-DV67pvrVaO4EOLzy/f8YuumRQmfTsuUyvK2qDPHhRcm0gGTqOxijqi5sEI5CkXi2PCCVMI3IN5DU4p3hrOivkA==","signatures":[{"sig":"MEUCID9LyG7wxjHvVOf3RwS0fFn8UJO529j1VDX0IO9cLRneAiEA7YwtTENLNnYmvxT5MmMoULKQpJkcBlQoM+mIybpBNXo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":32468,"size":6437,"noattachment":false,"key":"/worker-timers-broker/-/worker-timers-broker-7.1.8.tgz"},"main":"build/es5/bundle.js","types":"build/es2019/module.d.ts","config":{"commitizen":{"path":"cz-conventional-changelog"}},"module":"build/es2019/module.js","gitHead":"5b484f3045137c95bbb68f3b17de82a7239621b8","scripts":{"lint":"npm run lint:config && npm run lint:src && npm run lint:test","test":"grunt lint && grunt test","build":"rimraf build/* && tsc --project src/tsconfig.json && rollup --config config/rollup/bundle.mjs","prepare":"husky","lint:src":"tslint --config config/tslint/src.json --project src/tsconfig.json src/*.ts src/**/*.ts","lint:test":"eslint --config config/eslint/test.json --ext .js --report-unused-disable-directives test/","lint:config":"eslint --config config/eslint/config.json --ext .js --report-unused-disable-directives config/","prepublishOnly":"npm run build"},"_npmUser":{"name":"chrisguttandin","email":"chrisguttandin@media-codings.com"},"repository":{"url":"git+https://github.com/chrisguttandin/worker-timers-broker.git","type":"git"},"_npmVersion":"8.19.3","description":"The broker which is used by the worker-timers package.","directories":{},"_nodeVersion":"22.12.0","dependencies":{"tslib":"^2.8.1","@babel/runtime":"^7.26.0","fast-unique-numbers":"^9.0.15","worker-timers-worker":"^8.0.10"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.3.10","grunt":"^1.6.1","husky":"^9.1.7","karma":"^6.4.4","mocha":"^10.8.2","sinon":"^17.0.2","eslint":"^8.57.0","rimraf":"^6.0.1","rollup":"^4.29.1","tslint":"^6.1.3","webpack":"^5.97.1","grunt-sh":"^0.2.1","prettier":"^3.4.2","grunt-cli":"^1.5.0","ts-loader":"^9.5.1","commitizen":"^4.3.1","sinon-chai":"^3.7.0","typescript":"^5.7.2","@babel/core":"^7.26.0","karma-mocha":"^2.0.1","lint-staged":"^15.3.0","karma-webpack":"^5.0.1","@commitlint/cli":"^19.6.1","karma-sinon-chai":"^2.0.2","@babel/preset-env":"^7.26.0","load-grunt-config":"^4.0.1","tsconfig-holy-grail":"^15.0.2","@rollup/plugin-babel":"^6.0.4","karma-sauce-launcher":"^4.3.6","karma-chrome-launcher":"^3.2.0","karma-webkit-launcher":"^2.6.0","karma-firefox-launcher":"^2.1.3","eslint-config-holy-grail":"^60.0.17","tslint-config-holy-grail":"^56.0.6","cz-conventional-changelog":"^3.3.0","@commitlint/config-angular":"^19.6.0","@babel/plugin-external-helpers":"^7.25.9","@babel/plugin-transform-runtime":"^7.25.9"},"_npmOperationalInternal":{"tmp":"tmp/worker-timers-broker_7.1.8_1735948031178_0.5905347749942036","host":"s3://npm-registry-packages-npm-production"},"readme":"# worker-timers-broker\n\n**The broker which is used by the worker-timers package.**\n\n[![version](https://img.shields.io/npm/v/worker-timers-broker.svg?style=flat-square)](https://www.npmjs.com/package/worker-timers-broker)\n\n## Usage\n\nIn most cases using this package via [`worker-timers`](https://github.com/chrisguttandin/worker-timers) is probably the most convenient choice.\n\nHowever `worker-timers-broker` is published as a separate package on npm. It can be installed using the following command:\n\n```shell\nnpm install worker-timers-broker\n```\n\nThe package exports two functions.\n\n### load()\n\nThe `load()` function can be used to create a custom instance of `worker-timers` by explicitly specifying the URL which points to the code of the [`worker-timers-worker`](https://github.com/chrisguttandin/worker-timers-worker) package.\n\n```js\nimport { load } from 'worker-timers-broker';\n\nconst { clearInterval, clearTimeout, setInterval, setTimeout } = load('./the/worker-timers-worker/file');\n\nconst intervalId = setInterval(() => {\n    // do something many times\n}, 100);\n\nclearInterval(intervalId);\n\nconst timeoutId = setTimeout(() => {\n    // do something once\n}, 100);\n\nclearTimeout(timeoutId);\n```\n\n### wrap()\n\nThe `wrap()` function can be used to wrap a Web Worker instance which already runs the code of the [`worker-timers-worker`](https://github.com/chrisguttandin/worker-timers-worker) package.\n\nIn a project using [Vite](https://vite.dev) it can for example be used by leveraging [query suffixes](https://vite.dev/guide/features.html#import-with-query-suffixes).\n\n```js\nimport { wrap } from 'worker-timers-broker';\nimport createWorkerTimersWorker from 'worker-timers-worker?worker';\n\nconst { clearInterval, clearTimeout, setInterval, setTimeout } = wrap(createWorkerTimersWorker());\n\nconst intervalId = setInterval(() => {\n    // do something many times\n}, 100);\n\nclearInterval(intervalId);\n\nconst timeoutId = setTimeout(() => {\n    // do something once\n}, 100);\n\nclearTimeout(timeoutId);\n```\n\nPlease note the syntax for other build tools may vary.\n\n## Security contact information\n\nTo report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.\n","publish_time":1735948031375,"_cnpm_publish_time":1735948031375,"dist-tags":{"latest":"8.0.18"}}