{"_id":"@alekitto/nee","_rev":"1-810e56219088fd160206d30e620dd354","name":"@alekitto/nee","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@alekitto/nee","version":"1.0.0","description":"NodeJS EventEmitter ported to ES6","main":"lib/event-emitter.js","directories":{"test":"tests"},"scripts":{"test":"bash ./run-tests.sh"},"repository":{"type":"git","url":"git+https://github.com/alekitto/nee.git"},"keywords":["event-emitter"],"author":{"name":"Alessandro Chitolina","email":"alekitto@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/alekitto/nee/issues"},"homepage":"https://github.com/alekitto/nee#readme","devDependencies":{"babel-core":"^6.17.0","babel-istanbul":"^0.11.0","babel-preset-es2015":"^6.13.2"},"gitHead":"b78edb96837331552311fa0b6fa73f714566d6e7","_id":"@alekitto/nee@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.3","_npmUser":{"name":"alekitto","email":"alekitto@gmail.com"},"dist":{"integrity":"sha512-FWqbacLvHEH29IKH0qql/10NBxuZ1MtabQb0+DYPVc4WFTFAELZm3CVNE35L2cpCWuwCG7eQ3hLVfvvJzSsEEA==","shasum":"d0da63030f732fad408741b80c2146d9c6fe5b92","tarball":"https://registry.npmjs.org/@alekitto/nee/-/nee-1.0.0.tgz","fileCount":39,"unpackedSize":59910,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbvMioCRA9TVsSAnZWagAAuekP/ROg9NMwGUIABxxD7gEs\nSB7yHFuTbyKPPEsbv1Jxwd+N+2iT+97MABPZAgcbpO88HtUKsci3L/h1ck/6\nqClsJAFwM6xtrh35ZL0O6Y/V2A2t9YizmgRpTTcoN693Y63UTzdkYHuo1L4J\nTNX9UadkodDKWfDsgEbXF2WbRVkp8htcFWvVVcw9eLDAuMSfOaAWxRiGsi6z\nXeatS6NOvwgQa/bvAbZ7QtBSO8eDv7YBnx1AXQUzmXuC25fpDXLAhklx1Si9\n00IE2xSrKEKKsiTdCltXs4t5GCNbmpsh5t5L1vbQzDeLwJGKQsOViU9vidhq\nh56e0DwhJ54Mg1Ut88sGRVW4NSkoYaIZce8IW3d4X39A4bUxAbRfnl6ypHy6\n4qOVKpcoGvi3JQHMCpsuxP4eMoVPyrK88Z6Jmi/gjPs778H/u41ggZcknN5h\no2ZSJQ11FdW8CqpQNQXop4FWMlm4Sd1EvoO5kTV6FwecWrSoa/taqwW6DBaP\nT5WiCGf0ppVN9+nowPgx/2KwFEUDa29gb+A8RhA4hj+2wfTU/ekXD7gVq1PY\nw6HGOxXgwOaFNcSQysWGAmdK10PWBdOrPKzB399FDZSVmSs41BRehehUM9nn\nfhvc6ibEldL3VzW/L7NydezN2b65ta8ThjnCOHwsek/rjod3LU3ZvZnBilSd\nu/LZ\r\n=Jv41\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDBz4ht3Un2++rDbGhFSUHgC1vYBwFlmzm3ogHW7u6LUgIgMQ4/2Ga6ncQwcB1qHzv6DAT6ksXIrHQYoDCvv2Wkq6I="}]},"maintainers":[{"name":"alekitto","email":"alekitto@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nee_1.0.0_1539098792059_0.6362684652310571"},"_hasShrinkwrap":false}},"time":{"created":"2018-10-09T15:26:31.891Z","1.0.0":"2018-10-09T15:26:32.163Z","modified":"2022-04-04T12:37:17.113Z"},"maintainers":[{"name":"alekitto","email":"alekitto@gmail.com"}],"description":"NodeJS EventEmitter ported to ES6","homepage":"https://github.com/alekitto/nee#readme","keywords":["event-emitter"],"repository":{"type":"git","url":"git+https://github.com/alekitto/nee.git"},"author":{"name":"Alessandro Chitolina","email":"alekitto@gmail.com"},"bugs":{"url":"https://github.com/alekitto/nee/issues"},"license":"MIT","readme":"# nee\n\nNee is a porting of Node.JS EventEmitter class in ES2015. It's API is the same of the Node.JS's one (is based on the node v6 source code) and passes the same test suite used in node core\n\n------------\n\n### Why?\n\nBuilding complex web applications probably involves creating custom events on custom objects. Node.JS EventEmitter is an extremely powerful event emitter library, but cannot be used in a browser context.\n\nNee allows you to use it while creating your JS client code, compiling it along with your ES6+ code.\n\n### How?\n\nInstall via bower\n\n```sh\n$ bower install --save nee\n```\n\nand extend the EventEmitter class in your code\n\n```javascript\nimport EventEmitter from \"path/to/event-emitter\";\n\nclass MyEmitter extends EventEmitter\n{\n    method() {\n        let data = \"event_data\";\n        this.emit('event_one', data);\n    }\n}\n```\n\n### API\n\nStatic:\n\n- EventEmitter.defaultMaxListeners - By default, a maximum of 10 listeners can be registered for any single event. This limit can be changed for individual EventEmitter instances using the `emitter.setMaxListeners(n)` method.\n\nMethods:\n\n- addListener(event, handler) - Alias for `on(event, handler)`\n- emit(eventName[, arg1][, arg2][, ...]) - Synchronously calls each of the listeners registered for the event named eventName, in the order they were registered, passing the supplied arguments to each.\n  Returns true if the event had listeners, false otherwise.\n- eventNames() - Returns an array listing the events for which the emitter has registered listeners\n- getMaxListeners() - Returns the current max listener value for the emitter. Defaults to `defaultMaxListeners`\n- listenerCount(eventName) - Returns the number of listeners listening to the event named `eventName`\n- listeners(eventName) - Returns a copy of the array of listeners for the event named `eventName`\n- on(eventName, listener) - Adds the listener function to the end of the listeners array for the event named `eventName`. Returns self, so that calls can be chained\n- once(eventName, listener) - Adds a __one time__ listener function for the event named `eventName`. The next time `eventName` is triggered, this listener is removed and then invoked.\n- prependListener(eventName, listener) - Similar to `on`, but it adds the listener to the _beginning_ of the listener array\n- prependOnceListener(eventName, listener) - Adds a __one time__ listener to be _beginning_ of the listener array\n- removeAllListeners([eventName]) - Removes all listeners, or those of the specified `eventName`\n- removeListener(eventName, listener) - Removes `listener` from the listener array for the event named `eventName`\n- setMaxListeners(n) - Set the max listener count after which the EventEmitter should raise a _warning_\n\nEvents:\n\n- newListener(eventName, listener) - The EventEmitter instance will emit its own `newListener` event _before_ a listener is added to its internal array of listeners\n- removeListener(eventName, listener) - The `removeListener` event is emitted _after_ the listener is removed\n\n### Error events\n\nWhen an error occurs within an `EventEmitter` instance, the typical action is for an `'error'` event to be emitted. These are treated as special cases.\n\nIf an `EventEmitter` does not have at least one listener registered for the `'error'` event, and an `'error'` event is emitted, the error is thrown.\n\n```js\nconst myEmitter = new MyEmitter();\nmyEmitter.emit('error', new Error('whoops!'));\n// Throws\n```\n\n### License\n\nThis project is released under the terms of the MIT license. See LICENSE file for more information\n\n### Contributions\n\nContributions, thoughts and ideas are always welcome\n\nThanks for reading,\nA\n","readmeFilename":"README.md"}