{"_id":"pending-queue","_rev":"8-df42ad04e52ca9930b4d4bb52cbb6884","name":"pending-queue","dist-tags":{"latest":"1.2.1"},"versions":{"0.0.0":{"name":"pending-queue","version":"0.0.0","description":"","main":"index.js","scripts":{},"license":"MIT","_id":"pending-queue@0.0.0","_shasum":"6e8c769699a10c60c7d201e20d961db0b2863adb","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.7.1","_npmUser":{"name":"kael","email":"i@kael.me"},"maintainers":[{"name":"kael","email":"i@kael.me"}],"dist":{"shasum":"6e8c769699a10c60c7d201e20d961db0b2863adb","tarball":"https://registry.npmjs.org/pending-queue/-/pending-queue-0.0.0.tgz","integrity":"sha512-PAwfydp0MpavPN0BOG1hBIN8ULpNZYd4ljWoHYn7utShBUB8ckow8ts0K61oDeDpW8krpoXECeYKf3+nzzSEvw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGiXIBfhYQj2zP21u2W8HQf9zdGyRbnk7GJ4y6YyDjltAiAdUtigL7A22C+04EtUWiK7lozlJJ01k3zMOq2OadGtIw=="}]},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/pending-queue-0.0.0.tgz_1488951627105_0.7905614937189966"}},"1.0.0":{"name":"pending-queue","version":"1.0.0","description":"pending-queue ensures a certain asynchronous method only run once, and queues listeners which are registered to it.","main":"index.js","scripts":{"build":"babel src --out-dir lib","test":"npm run build && node --harmony ./node_modules/.bin/ava --verbose --timeout=10s","prepublish":"npm run build"},"repository":{"type":"git","url":"git://github.com/kaelzhang/node-pending-queue.git"},"keywords":["pending-queue","promise","queue","pending"],"engines":{"node":">=4"},"author":{"name":"kaelzhang"},"license":"MIT","bugs":{"url":"https://github.com/kaelzhang/node-pending-queue/issues"},"ava":{"require":"babel-register","babel":{"babelrc":true}},"devDependencies":{"ava":"^0.16.0","babel-cli":"^6.16.0","babel-plugin-syntax-trailing-function-commas":"^6.13.0","babel-plugin-transform-class-properties":"^6.16.0","babel-plugin-transform-es2015-modules-commonjs":"^6.16.0","babel-plugin-transform-exponentiation-operator":"^6.8.0","babel-plugin-transform-inline-environment-variables":"^6.8.0","babel-plugin-transform-object-rest-spread":"^6.16.0","babel-preset-es2015":"^6.16.0","delay":"^1.3.1"},"dependencies":{"p-is-promise":"^1.1.0"},"gitHead":"da595a3357559056dfb9b902ce98f26968039eb2","homepage":"https://github.com/kaelzhang/node-pending-queue#readme","_id":"pending-queue@1.0.0","_shasum":"c9a84cf81f1e39b4e9a66520275eb64b2c82c31b","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.7.1","_npmUser":{"name":"kael","email":"i@kael.me"},"maintainers":[{"name":"kael","email":"i@kael.me"}],"dist":{"shasum":"c9a84cf81f1e39b4e9a66520275eb64b2c82c31b","tarball":"https://registry.npmjs.org/pending-queue/-/pending-queue-1.0.0.tgz","integrity":"sha512-r11cwtvTmEkRwGdftTeFlT2AWi5Q/y2T+riUyTcsDQIAA3YrxYgiHoMlKysKkfRoZcrllBxM9Ptc+lsuIq1ZYQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH5U1zfEJXKHNjs3rJ4fkeq84xEn+g/L+MZyUBe2b9oHAiEAwf631BvbFunQqLGc7o/QqsrLHFvDVuLgtk9Jne/83K0="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pending-queue-1.0.0.tgz_1488965540036_0.5087923344690353"}},"1.1.0":{"name":"pending-queue","version":"1.1.0","description":"pending-queue ensures a certain asynchronous method only run once, and queues listeners which are registered to it.","main":"index.js","scripts":{"build":"babel src --out-dir lib","test":"npm run build && node --harmony ./node_modules/.bin/ava --verbose --timeout=10s","prepublish":"npm run build"},"repository":{"type":"git","url":"git://github.com/kaelzhang/node-pending-queue.git"},"keywords":["pending-queue","promise","queue","pending"],"engines":{"node":">=4"},"author":{"name":"kaelzhang"},"license":"MIT","bugs":{"url":"https://github.com/kaelzhang/node-pending-queue/issues"},"ava":{"require":"babel-register","babel":{"babelrc":true}},"devDependencies":{"ava":"^0.16.0","babel-cli":"^6.16.0","babel-plugin-syntax-trailing-function-commas":"^6.13.0","babel-plugin-transform-class-properties":"^6.16.0","babel-plugin-transform-es2015-modules-commonjs":"^6.16.0","babel-plugin-transform-exponentiation-operator":"^6.8.0","babel-plugin-transform-inline-environment-variables":"^6.8.0","babel-plugin-transform-object-rest-spread":"^6.16.0","babel-preset-es2015":"^6.16.0","delay":"^1.3.1"},"dependencies":{"p-is-promise":"^1.1.0"},"gitHead":"5968fe313e9ac942b811eaa5eecea59f24799bba","homepage":"https://github.com/kaelzhang/node-pending-queue#readme","_id":"pending-queue@1.1.0","_shasum":"98bdf1e48e5f320b6acc898517d17ee7b8b0261f","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.7.1","_npmUser":{"name":"kael","email":"i@kael.me"},"maintainers":[{"name":"kael","email":"i@kael.me"}],"dist":{"shasum":"98bdf1e48e5f320b6acc898517d17ee7b8b0261f","tarball":"https://registry.npmjs.org/pending-queue/-/pending-queue-1.1.0.tgz","integrity":"sha512-9YdkuQBWh2OaB3MbMk+VaVP9pAutdnW/pFD/QXN7G/Is5VHNMoxtbRgQSTFVOFGmuS5IouQ2bLNbmLAo8T4k3w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAfqMjhH0CV/8pc4kuVpEhSIImIp3MH2ES2EkYik/Bh5AiEAshgihsuJNISkw0muG5v86GzQr+ukDc32KTlEpuB656s="}]},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/pending-queue-1.1.0.tgz_1488968027992_0.17680542031303048"}},"1.1.1":{"name":"pending-queue","version":"1.1.1","description":"pending-queue ensures a certain asynchronous method only run once, and queues listeners which are registered to it.","main":"index.js","scripts":{"build":"babel src --out-dir lib","test":"npm run build && node --harmony ./node_modules/.bin/ava --verbose --timeout=10s","prepublish":"npm run build"},"repository":{"type":"git","url":"git://github.com/kaelzhang/node-pending-queue.git"},"keywords":["pending-queue","promise","queue","pending"],"engines":{"node":">=4"},"author":{"name":"kaelzhang"},"license":"MIT","bugs":{"url":"https://github.com/kaelzhang/node-pending-queue/issues"},"ava":{"require":"babel-register","babel":{"babelrc":true}},"devDependencies":{"ava":"^0.16.0","babel-cli":"^6.16.0","babel-plugin-syntax-trailing-function-commas":"^6.13.0","babel-plugin-transform-class-properties":"^6.16.0","babel-plugin-transform-es2015-modules-commonjs":"^6.16.0","babel-plugin-transform-exponentiation-operator":"^6.8.0","babel-plugin-transform-inline-environment-variables":"^6.8.0","babel-plugin-transform-object-rest-spread":"^6.16.0","babel-preset-es2015":"^6.16.0","delay":"^1.3.1"},"dependencies":{"p-is-promise":"^1.1.0"},"gitHead":"5968fe313e9ac942b811eaa5eecea59f24799bba","homepage":"https://github.com/kaelzhang/node-pending-queue#readme","_id":"pending-queue@1.1.1","_shasum":"e70a7a38d5dd22d5e2917ef6da07539d21dead40","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.7.1","_npmUser":{"name":"kael","email":"i@kael.me"},"maintainers":[{"name":"kael","email":"i@kael.me"}],"dist":{"shasum":"e70a7a38d5dd22d5e2917ef6da07539d21dead40","tarball":"https://registry.npmjs.org/pending-queue/-/pending-queue-1.1.1.tgz","integrity":"sha512-wS+l0XqwACYjhz1SIVWgbFMJ59sg8m/xk+NY0i9HPmCxcr5+/HicMRj0GvYHv+gj/ZLH3Tziw9iROkl7EKUhdA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDyg0Lcp/7ipD0AOr71u1pUbLsv1zcRXswS+/dGRustMAiBXi9bgYM9WJZueJ2ctoZbhtYzkHvyFA3QiVBBgb9XRVw=="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pending-queue-1.1.1.tgz_1488970017185_0.9098586656618863"}},"1.2.0":{"name":"pending-queue","version":"1.2.0","description":"pending-queue ensures a certain asynchronous method only run once, and queues listeners which are registered to it.","main":"index.js","scripts":{"build":"babel src --out-dir lib","test":"npm run build && node --harmony ./node_modules/.bin/ava --verbose --timeout=10s","prepublish":"npm run build"},"repository":{"type":"git","url":"git://github.com/kaelzhang/node-pending-queue.git"},"keywords":["pending-queue","promise","queue","pending"],"engines":{"node":">=4"},"author":{"name":"kaelzhang"},"license":"MIT","bugs":{"url":"https://github.com/kaelzhang/node-pending-queue/issues"},"ava":{"require":"babel-register","babel":{"babelrc":true}},"devDependencies":{"ava":"^0.16.0","babel-cli":"^6.16.0","babel-plugin-syntax-trailing-function-commas":"^6.13.0","babel-plugin-transform-class-properties":"^6.16.0","babel-plugin-transform-es2015-modules-commonjs":"^6.16.0","babel-plugin-transform-exponentiation-operator":"^6.8.0","babel-plugin-transform-inline-environment-variables":"^6.8.0","babel-plugin-transform-object-rest-spread":"^6.16.0","babel-preset-es2015":"^6.16.0","delay":"^1.3.1"},"dependencies":{"p-is-promise":"^1.1.0"},"gitHead":"267a12a748a433bcc32eb9cb1645b3b9669da3ae","homepage":"https://github.com/kaelzhang/node-pending-queue#readme","_id":"pending-queue@1.2.0","_shasum":"867d331edd8d16730cae9919041d3f174be192c5","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.7.1","_npmUser":{"name":"kael","email":"i@kael.me"},"maintainers":[{"name":"kael","email":"i@kael.me"}],"dist":{"shasum":"867d331edd8d16730cae9919041d3f174be192c5","tarball":"https://registry.npmjs.org/pending-queue/-/pending-queue-1.2.0.tgz","integrity":"sha512-bC8n/N22iZj73a6DbkGVjq9bwVKqQ2mlBjelFoIRa2YoDorqSxwtnt8jlC/64h/QTPnUfPlsCN1oCKOKd+rZeQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID2U9Sc7JOU5Bem2NHmSPE+j6unttVviMcdDWIlMC2H3AiEAttYNCKiyLoZr0as0p2vxjEndthgHHFvAdFypRzoTUSI="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pending-queue-1.2.0.tgz_1489024110920_0.30361844366416335"}},"1.2.1":{"name":"pending-queue","version":"1.2.1","description":"pending-queue ensures a certain asynchronous method only run once, and queues listeners which are registered to it.","main":"index.js","scripts":{"build":"babel src --out-dir lib","test":"npm run build && node --harmony ./node_modules/.bin/ava --verbose --timeout=10s","prepublish":"npm run build"},"repository":{"type":"git","url":"git://github.com/kaelzhang/node-pending-queue.git"},"keywords":["pending-queue","promise","queue","pending"],"engines":{"node":">=4"},"author":{"name":"kaelzhang"},"license":"MIT","bugs":{"url":"https://github.com/kaelzhang/node-pending-queue/issues"},"ava":{"require":"babel-register","babel":{"babelrc":true}},"devDependencies":{"ava":"^0.16.0","babel-cli":"^6.16.0","babel-plugin-syntax-trailing-function-commas":"^6.13.0","babel-plugin-transform-class-properties":"^6.16.0","babel-plugin-transform-es2015-modules-commonjs":"^6.16.0","babel-plugin-transform-exponentiation-operator":"^6.8.0","babel-plugin-transform-inline-environment-variables":"^6.8.0","babel-plugin-transform-object-rest-spread":"^6.16.0","babel-preset-es2015":"^6.16.0","delay":"^1.3.1"},"gitHead":"675581521ee6147bba1f55e7512e424aa0c28236","homepage":"https://github.com/kaelzhang/node-pending-queue#readme","_id":"pending-queue@1.2.1","_npmVersion":"5.5.1","_nodeVersion":"9.2.0","_npmUser":{"name":"kael","email":"i@kael.me"},"dist":{"integrity":"sha512-2G3Ew7MWjd01VqCpFNLYd8G+wQluv0epqc/7BfpEQlRHD0Pd99zxWDJcPVeYNKp5E4i95qd50PnWSTN4SqaNkQ==","shasum":"ee5c080868661be3ec5fd3e027aa38db247070b9","tarball":"https://registry.npmjs.org/pending-queue/-/pending-queue-1.2.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAYwDvAclw5tDntnwkzxASDMvR83N6/GfDiRc77GhJ23AiEApFKV/LPc7NvVcxsNvQLYla9zOp2YLuOfPDBr3abftIc="}]},"maintainers":[{"name":"kael","email":"i@kael.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pending-queue-1.2.1.tgz_1511762437880_0.959535910282284"}}},"readme":"[![Build Status](https://travis-ci.org/kaelzhang/node-pending-queue.svg?branch=master)](https://travis-ci.org/kaelzhang/node-pending-queue)\n<!-- optional appveyor tst\n[![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/kaelzhang/node-pending-queue?branch=master&svg=true)](https://ci.appveyor.com/project/kaelzhang/node-pending-queue)\n-->\n<!-- optional npm version\n[![NPM version](https://badge.fury.io/js/pending-queue.svg)](http://badge.fury.io/js/pending-queue)\n-->\n<!-- optional npm downloads\n[![npm module downloads per month](http://img.shields.io/npm/dm/pending-queue.svg)](https://www.npmjs.org/package/pending-queue)\n-->\n<!-- optional dependency status\n[![Dependency Status](https://david-dm.org/kaelzhang/node-pending-queue.svg)](https://david-dm.org/kaelzhang/node-pending-queue)\n-->\n\n# pending-queue\n\n`pending-queue` ensures a certain asynchronous method only run once, and queues listeners which are registered to it.\n\n## Install\n\n```sh\n$ npm install pending-queue --save\n```\n\n## Usage\n\n```js\nconst Queue = require('pending-queue')\n\nlet counter = 0\nconst queue = new Queue({\n  load: (a, b) => {\n    return new Promise((resolve) => {\n      counter ++\n      setTimeout(() => {\n        resolve(a + b)\n      }, 100)\n    })\n  }\n})\n\nfunction run () {\n  queue.add(1, 2).then((value) => {\n    console.log(value, counter)\n  })\n}\n\nrun()\nrun()\nrun()\n\n// 3, 1\n// 3, 1\n// 3, 1\n\n// So the load function ran only once.\n```\n\n## new Queue({load, stringify})\n\n- **load** `function(...params)` the method to get the value\n- **stringify** `function(params)=JSON.stringify` stringify the parameters as the key to queue all asynchronous requests.\n\nReturns `EventEmitter`, and `key` as the event name, so you can use `queue.listenerCount(key)` to see if there are pending tasks.\n\n## Events\n\n- **load**\n\n## .add(...params)\n\n- **params** `Arguments` which will be passed into `load`\n\nReturns `Promise`\n\n## .addWithKey(key, ...params)\n\n- **key** `String`\n\nReturn `Promise`\n\nSpecifies the key ourself, and avoid using `options.stringify` to serialize the key from `params`.\n\nBut pay attension that there should be a consistent **one-to-one** match between `key` and `params`, or make sure that you exactly know what you are doing.\n\n## License\n\nMIT\n","maintainers":[{"name":"kael","email":"i@kael.me"}],"time":{"modified":"2022-06-23T17:49:56.200Z","created":"2017-03-08T05:40:28.882Z","0.0.0":"2017-03-08T05:40:28.882Z","1.0.0":"2017-03-08T09:32:20.299Z","1.1.0":"2017-03-08T10:13:49.967Z","1.1.1":"2017-03-08T10:46:57.451Z","1.2.0":"2017-03-09T01:48:31.184Z","1.2.1":"2017-11-27T06:00:37.957Z"},"license":"MIT","readmeFilename":"README.md","description":"pending-queue ensures a certain asynchronous method only run once, and queues listeners which are registered to it.","homepage":"https://github.com/kaelzhang/node-pending-queue#readme","keywords":["pending-queue","promise","queue","pending"],"repository":{"type":"git","url":"git://github.com/kaelzhang/node-pending-queue.git"},"author":{"name":"kaelzhang"},"bugs":{"url":"https://github.com/kaelzhang/node-pending-queue/issues"}}