{"_id":"namespace-emitter","_rev":"2783737","name":"namespace-emitter","description":"tiny event emitter with namespaces","dist-tags":{"latest":"2.0.1"},"maintainers":[{"name":"sethvincent","email":"sethvincent@gmail.com"}],"time":{"modified":"2022-06-13T06:10:14.000Z","created":"2015-12-23T01:55:22.553Z","2.0.1":"2018-01-30T00:59:47.444Z","2.0.0":"2017-07-21T23:59:47.953Z","1.0.0":"2015-12-23T01:55:22.553Z"},"users":{},"author":{"name":"sethvincent","email":"sethvincent@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/sethvincent/namespace-emitter.git"},"versions":{"2.0.1":{"name":"namespace-emitter","version":"2.0.1","description":"tiny event emitter with namespaces","main":"index.js","scripts":{"build-docs":"documentation-readme -s 'API'","lint":"standard","test":"tape test.js | tap-spec","start":"budo example.js --live"},"repository":{"type":"git","url":"git+https://github.com/sethvincent/namespace-emitter.git"},"keywords":["eventemitter","events","namespaces"],"author":{"name":"sethvincent","email":"sethvincent@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/sethvincent/namespace-emitter/issues"},"homepage":"https://github.com/sethvincent/namespace-emitter#readme","devDependencies":{"budo":"^10.0.3","documentation-readme":"^2.1.1","nanobench":"^2.1.0","standard":"^10.0.2","tap-spec":"^4.1.1","tape":"^4.7.0"},"gitHead":"f0a5d0e6c3a5fd2d6f1665e7e6af0ded925430ca","_id":"namespace-emitter@2.0.1","_npmVersion":"5.5.1","_nodeVersion":"7.6.0","_npmUser":{"name":"sethvincent","email":"sethvincent@gmail.com"},"dist":{"shasum":"978d51361c61313b4e6b8cf6f3853d08dfa2b17c","size":3756,"noattachment":false,"key":"/namespace-emitter/-/namespace-emitter-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/namespace-emitter/download/namespace-emitter-2.0.1.tgz"},"maintainers":[{"name":"sethvincent","email":"sethvincent@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/namespace-emitter-2.0.1.tgz_1517273987379_0.3870966855902225"},"directories":{},"publish_time":1517273987444,"_hasShrinkwrap":false,"_cnpm_publish_time":1517273987444,"_cnpmcore_publish_time":"2021-12-16T18:55:02.485Z"},"2.0.0":{"name":"namespace-emitter","version":"2.0.0","description":"tiny event emitter with namespaces","main":"index.js","scripts":{"build-docs":"documentation-readme -s 'API'","lint":"standard","test":"tape test.js | tap-spec","start":"budo example.js --live"},"repository":{"type":"git","url":"git+https://github.com/sethvincent/namespace-emitter.git"},"keywords":["eventemitter","events","namespaces"],"author":{"name":"sethvincent","email":"sethvincent@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/sethvincent/namespace-emitter/issues"},"homepage":"https://github.com/sethvincent/namespace-emitter#readme","devDependencies":{"budo":"^10.0.3","documentation-readme":"^2.1.1","nanobench":"^2.1.0","standard":"^10.0.2","tap-spec":"^4.1.1","tape":"^4.7.0"},"gitHead":"f0fec0c4f6f23af01c5ff55893a83682516ad8bf","_id":"namespace-emitter@2.0.0","_npmVersion":"5.3.0","_nodeVersion":"6.11.1","_npmUser":{"name":"sethvincent","email":"sethvincent@gmail.com"},"dist":{"shasum":"9d06e88c03eb7118cb1bc776a2416fc949f63fd3","size":3790,"noattachment":false,"key":"/namespace-emitter/-/namespace-emitter-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/namespace-emitter/download/namespace-emitter-2.0.0.tgz"},"maintainers":[{"name":"sethvincent","email":"sethvincent@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/namespace-emitter-2.0.0.tgz_1500681587858_0.11561641748994589"},"directories":{},"publish_time":1500681587953,"_hasShrinkwrap":false,"_cnpm_publish_time":1500681587953,"_cnpmcore_publish_time":"2021-12-16T18:55:02.696Z"},"1.0.0":{"name":"namespace-emitter","version":"1.0.0","description":"tiny event emitter with namespaces","main":"index.js","scripts":{"build-docs":"documentation-readme -s 'API'","test":"standard && tape test.js | tap-spec","start":"budo example.js --live"},"repository":{"type":"git","url":"git+https://github.com/sethvincent/namespace-emitter.git"},"keywords":["eventemitter","events","namespaces"],"author":{"name":"sethvincent","email":"sethvincent@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/sethvincent/namespace-emitter/issues"},"homepage":"https://github.com/sethvincent/namespace-emitter#readme","devDependencies":{"budo":"^7.0.4","documentation-readme":"^2.1.1","standard":"^5.4.1","tap-spec":"^4.1.1","tape":"^4.2.2"},"gitHead":"82e2cb39d3ce2664ab6c1c013d0b9fc3c6adff8a","_id":"namespace-emitter@1.0.0","_shasum":"1bf3a7b8a40c77507025f3309a043abebf5c3d8f","_from":".","_npmVersion":"3.5.0","_nodeVersion":"4.2.2","_npmUser":{"name":"sethvincent","email":"sethvincent@gmail.com"},"maintainers":[{"name":"sethvincent","email":"sethvincent@gmail.com"}],"dist":{"shasum":"1bf3a7b8a40c77507025f3309a043abebf5c3d8f","size":3361,"noattachment":false,"key":"/namespace-emitter/-/namespace-emitter-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/namespace-emitter/download/namespace-emitter-1.0.0.tgz"},"directories":{},"publish_time":1450835722553,"_hasShrinkwrap":false,"_cnpm_publish_time":1450835722553,"_cnpmcore_publish_time":"2021-12-16T18:55:02.899Z"}},"readme":"# namespace-emitter\n\nA small event emitter with namespaces.\n\nNot meant as a replacement for node's events module, but as a small component for browser js.\n\n## Install\n\n    npm install --save namespace-emitter\n\n## Example\n\n```js\nvar emitter = require('namespace-emitter')()\n\nemitter.on('*', function () {\n  console.log('all events emitted', this.event)\n})\n\nemitter.on('example', function () {\n  console.log('example event emitted')\n})\n\nemitter.emit('example')\n// -> example event emitted\n// -> all events emitted example\n\nemitter.on('demo', function () {\n  console.log('multiple events with `demo` namespace emitted', this.event)\n})\n\nemitter.emit('demo:cool')\n// -> all events emitted demo:cool\n// -> multiple events with `demo` namespace emitted demo:cool\n\nemitter.emit('demo:awesome')\n// -> all events emitted demo:awesome\n// -> multiple events with `demo` namespace emitted demo:awesome\n\nemitter.emit('demo:great')\n// -> all events emitted demo:great\n// -> multiple events with `demo` namespace emitted demo:great\n```\n\n## API\n\n### createNamespaceEmitter\n\nCreate an event emitter with namespaces\n\n**Examples**\n\n```javascript\nvar emitter = require('./index')()\n\nemitter.on('*', function () {\n  console.log('all events emitted', this.event)\n})\n\nemitter.on('example', function () {\n  console.log('example event emitted')\n})\n```\n\n### emit\n\nEmit an event. Optionally namespace the event. Handlers are fired in the order in which they were added with exact matches taking precedence. Separate the namespace and event with a `:`\n\n**Parameters**\n\n-   `event` **String** – the name of the event, with optional namespace\n-   `data` **...Any** – data variables that will be passed as arguments to the event listener\n\n**Examples**\n\n```javascript\nemitter.emit('example')\nemitter.emit('demo:test')\nemitter.emit('data', { example: true}, 'a string', 1)\n```\n\n### off\n\nStop listening to an event. Stop all listeners on an event by only passing the event name. Stop a single listener by passing that event handler as a callback.\nYou must be explicit about what will be unsubscribed: `emitter.off('demo')` will unsubscribe an `emitter.on('demo')` listener, \n`emitter.off('demo:example')` will unsubscribe an `emitter.on('demo:example')` listener\n\n**Parameters**\n\n-   `event` **String** \n-   `fn` **[Function]** – the specific handler\n\n**Examples**\n\n```javascript\nemitter.off('example')\nemitter.off('demo', function () {})\n```\n\n### on\n\nCreate en event listener.\n\n**Parameters**\n\n-   `event` **String** \n-   `fn` **Function** \n\n**Examples**\n\n```javascript\nemitter.on('example', function () {})\nemitter.on('demo', function () {})\n```\n\n### once\n\nCreate en event listener that fires once.\n\n**Parameters**\n\n-   `event` **String** \n-   `fn` **Function** \n\n**Examples**\n\n```javascript\nemitter.once('example', function () {})\nemitter.once('demo', function () {})\n```\n\n## License\n\n[MIT](LICENSE.md)\n","_attachments":{},"homepage":"https://github.com/sethvincent/namespace-emitter#readme","bugs":{"url":"https://github.com/sethvincent/namespace-emitter/issues"},"license":"MIT"}