{"_id":"@dreamworld/event-emitter","_rev":"4-f41e188058053ffca86ac7f86d43dd76","name":"@dreamworld/event-emitter","dist-tags":{"latest":"1.1.0","webpack-compatible":"1.1.0-webpack-compatible.1","webpack-compatible1":"1.1.0-webpack-compatible1.1"},"versions":{"1.0.0":{"name":"@dreamworld/event-emitter","version":"1.0.0","description":"It's library by using we can bind event on any class instance","main":"event-emitter.js","type":"module","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/DreamworldSolutions/EventEmitter.git"},"keywords":["Event-Emitter","event"],"author":{"name":"Dhruval Kodinariya"},"license":"ISC","bugs":{"url":"https://github.com/DreamworldSolutions/EventEmitter/issues"},"homepage":"https://github.com/DreamworldSolutions/EventEmitter#readme","dependencies":{},"devDependencies":{"semantic-release":"17.0.8"},"publishConfig":{"access":"public"},"release":{"branches":["+([0-9])?(.{+([0-9]),x}).x","master",{"name":"feature/*","prerelease":"${name.replace(/^feature\\//g,\"\")}","channel":"${name.replace(/^feature\\//g,\"\")}"}]},"gitHead":"09818033c6474d9bafb66ba5e4ae232c7168b5ce","_id":"@dreamworld/event-emitter@1.0.0","_nodeVersion":"14.15.2","_npmVersion":"6.14.9","dist":{"integrity":"sha512-sSpLFZzIBoGEa3To2u1BfudNju46Ok0RIqRzXnWPwlCMtwzqqY+Tu9at9kRaOTK/921UuO7ubY5zSy21qXgiPw==","shasum":"960688fbc14ad49fd6f52b73aa777da3e4982d8e","tarball":"https://registry.npmjs.org/@dreamworld/event-emitter/-/event-emitter-1.0.0.tgz","fileCount":4,"unpackedSize":11467,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf2xoWCRA9TVsSAnZWagAAcOsQAIkR94MfDCPMoctuxPJD\nq8dt7rMomgvdAeltNYgCkfgYg1P1NN0QOuntltvJkIlR3fM62jp/GM5/2CR3\ngRREtSmDJFtpWaUrDpsAVigJabL4VovY1FN9vgjBCzdrTV+P7q5j0nLbjDNx\nIoLOY6duhc4gPtJ4mBz3KD2imjnrhXYRr/jEnCh/IwTEiI97CpfEzas+CHaW\nilwGYWS/cSzSY3Kos3kQGOvtyqS9c8+0zM+HuAN5INBkRSNTdYhkkCaBLhVh\n480j2hjWjbNpGQAMAIBRVPGQmR1mKU+ADvUhYVywM7FN+20+jdKKPTnMEmQH\nn2J0SBx+yz2iNISQ5xDPHDTLaBFaqbFHDZTKm6QIe0fi8jEdu5lhdxJClqQC\nN4MZbt8/TMkINAvV78HXJF92obc+TBxHQmcS6nXHf2CvO2x3+ie33tuedpYz\nmYXHXtX62JQ3xH+vvd6eO8Q3sURbE8uMKmYicLfkg5ktnLrikwRSBQzJ64Qr\ngNhMCKGXzUeRfc9TF7nRnmAGga2UtgfENXq2zqxQjZ2H3kHV2jCQZJj6nZzJ\nUPUeoeJjYA8FTYrKsU6BpDTuiSnilX8EuzyKz71YZ/Bxo/N9juSTDJPwwZkc\nkq/gB4Jqppope/KxDB2mEv+qql6XdzlZx4n8N+yxssDNq1oXnUK9R3sK1z1L\nWCZH\r\n=V04z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEyqmpQrGRlPkfWfOFRvVRZ+tTwZsKvwebo32Ffkot3iAiBFqEm2BRFc1uJ3nnO+MvaFlnTA+FVaIyfos7nJMTNHUg=="}]},"_npmUser":{"name":"dw-devops","email":"dreamworld.devops@gmail.com"},"directories":{},"maintainers":[{"name":"chiragmoradiya","email":"chirag@dreamworldsolutions.com"},{"name":"chetang7","email":"chetan@dreamworldsolutions.com"},{"name":"ajay-dhameliya","email":"ajay@dreamworldsolutions.com"},{"name":"dw-devops","email":"dreamworld.devops@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-emitter_1.0.0_1608194582120_0.35113973646972263"},"_hasShrinkwrap":false},"1.1.0-webpack-compatible.1":{"name":"@dreamworld/event-emitter","version":"1.1.0-webpack-compatible.1","description":"It's library by using we can bind event on any class instance","main":"event-emitter.js","type":"module","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/DreamworldSolutions/EventEmitter.git"},"keywords":["Event-Emitter","event"],"author":{"name":"Dhruval Kodinariya"},"license":"ISC","bugs":{"url":"https://github.com/DreamworldSolutions/EventEmitter/issues"},"homepage":"https://github.com/DreamworldSolutions/EventEmitter#readme","dependencies":{},"devDependencies":{"semantic-release":"17.0.8"},"publishConfig":{"access":"public"},"release":{"branches":["+([0-9])?(.{+([0-9]),x}).x","master",{"name":"feature/*","prerelease":"${name.replace(/^feature\\//g,\"\")}","channel":"${name.replace(/^feature\\//g,\"\")}"}]},"readme":"# EventEmitter\n\n## Use cases\n\n```javascript\nimport EventEmitter from  \"@dreamworld/event-emitter/event-emitter.js\";\n\n//This code simply creates an instance of EventEmitter to be used.\nvar ee = new EventEmitter();\n```\n### Adding listeners\n\nA listener is a function that is executed when an event is emitted. You can add them in a multitude of ways, the simplest of which is with the `addListener` method.\n\n```javascript\nfunction listener() {\n    console.log('The foo event has been emitted.');\n}\n\nee.addListener('foo', listener);\n```\n\nYou can also add in bulk using the `addListeners` method (notice the \"s\" on the end). You can interact with addListeners in two ways, the first is to pass it an event name and array of listeners to add.\n\n```javascript\nfunction listener1() {\n    console.log('ONE');\n}\n\nfunction listener2() {\n    console.log('TWO');\n}\n\nee.addListeners('foo', [listener1, listener2]);\n```\n\nThe second way of calling addListeners involves passing an object of event names and listeners. You can either pass a single listener for each event or an array, just as you can see above.\n\n```javascript\nfunction listener1() {\n    console.log('ONE');\n}\n\nfunction listener2() {\n    console.log('TWO');\n}\n\nfunction listener3() {\n    console.log('THREE');\n}\n\nee.addListeners({\n    foo: [listener1, listener2],\n    bar: listener3\n});\n```\n\n### Removing listeners\n\nThis works in the _exact_ same way as adding listeners. The only difference is that you replace the `add` in the method names with `remove`. Like this:\n\n```javascript\nfunction listener() {\n    console.log('The foo event has been emitted.');\n}\n\nee.addListener('foo', listener);\nee.removeListener('foo', listener);\n```\n\nIf you want a listener to remove itself after it has been called or after a condition has been met then all you need to do is return true.\n\n```javascript\nfunction listener1() {\n    // If a condition is met then remove the listener\n    if(completed) {\n        return true;\n    }\n}\n\nfunction listener2() {\n    // Always remove after use\n    return true;\n}\n\nee.addListeners('foo', [listener1, listener2]);\nee.emitEvent('foo');\n```\n\nIf you do not want to, or can't for some reason, return true, you can set the return value using `setOnceReturnValue`.\n\n```javascript\nfunction listener() {\n    // Always remove after use\n    return 'REMOVE-ME';\n}\n\nee.addListener('foo', listener);\nee.setOnceReturnValue('REMOVE-ME');\nee.emitEvent('foo');\n```\n\nAlternatively you can use the `addOnceListener` method, or it's alias, `once`.\n\n```javascript\nfunction listener() {\n    // Do stuff\n}\n\nee.addOnceListener('foo', listener);\nee.emitEvent('foo');\n// The listener will be removed now...\nee.emitEvent('foo');\n\n// The listener will only be executed once.\n```\n\nYou can also remove whole events and all of their attached listeners with the `removeEvent` method. If you pass an event name to the method then it will remove that event and it's listeners.\n\n```javascript\nfunction listener1() {\n    console.log('ONE');\n}\n\nfunction listener2() {\n    console.log('TWO');\n}\n\nee.addListeners('foo', [listener1, listener2]);\nee.removeEvent('foo');\n```\n\nHowever, if you leave it blank and do not pass an event name, then **all** events will be removed. It will wipe everything.\n\n### Fetching the listeners\n\nIf you really need to then you can get an array of all listeners attached to an event with the `getListeners` method.\n\n```javascript\nfunction listener1() {\n    console.log('ONE');\n}\n\nfunction listener2() {\n    console.log('TWO');\n}\n\nee.addListeners('foo', [listener1, listener2]);\nee.getListeners('foo');\n```\n\n### Emitting events\n\nSo once you have added your listeners and you are ready to start executing them, you can start to use the `emitEvent` method. At it's most basic level it will just execute all listeners attached to an event.\n\n```javascript\nfunction listener1() {\n    console.log('ONE');\n}\n\nfunction listener2() {\n    console.log('TWO');\n}\n\nee.addListeners('foo', [listener1, listener2]);\nee.emitEvent('foo');\n```\n\nFor more control, you can pass an arguments array as the second argument. This array will be applied to every listener as individual arguments.\n\n```javascript\nfunction adder(a, b) {\n    console.log(a + b);\n}\n\nee.addListener('addStuff', adder);\nee.emitEvent('addStuff', [10, 20]);\n```\n\n### Method aliases\n\n[Hebo](https://github.com/Hebo), from GitHub, [contributed three aliases](https://github.com/Olical/EventEmitter/pull/35#issuecomment-9920932) to add, remove and emit. The aliases can be found in the [API documentation](https://github.com/Olical/EventEmitter/blob/master/docs/api.md) but here is the mapping.\n\n * `on` - `addListener`\n * `off` - `removeListener`\n * `trigger` - `emitEvent`\n\nI've also added one since then.\n\n * `once` - `addOnceListener`\n\n### Using regular expressions\n\nYou can pass a regular expression to pretty much every function in EventEmitter in place of an event name string. So if you have two events, say, bar and baz, you can manipulate both of them with `/ba[rz]/`.\n\nThis applies to adding, removing and emitting events as well as a few others. There is one thing you have to remember when using this though, you must have the event defined before you use it in a regex.\n\nBy defined I mean, it has to have some other listener added to it, or you have to explicitly define it with the `defineEvent` / `defineEvents` functions. Here is an example of defining some events and adding to both with a regular expression.\n\n```javascript\nee.defineEvents(['bar', 'baz']);\nee.addListener(/ba[rz]/, function () {\n    console.log('Now you are thinking with regular expressions.');\n});\nee.emitEvent(/ba[rz]/);\n```\n\n## Extending with the EventEmitter class\n\nYou probably won't want to use EventEmitter as a raw class. You will probably want to write a `Player` class or something like that and implement EventEmitter's methods into it. To do this you will need to clone and merge EventEmitter's prototype object into your classes prototype object.\n\n```javascript\nclass Player(){}\n\nObject.assign(Player.prototype, EventEmitter.prototype);\n```","readmeFilename":"README.md","gitHead":"94600e46e7f2884d3b8b142af3391c37f1374157","_id":"@dreamworld/event-emitter@1.1.0-webpack-compatible.1","_nodeVersion":"16.13.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-HnLnVDrcZk8l2hp02JzIJvNhNFM9put8o5rOVl0BReD2oxNhqn7pkPIcl7rO7Ua8a2skrV8XJQ+6aIE0KmfdBQ==","shasum":"8341f6e05cd1a05c858e3b97d685a6c6060d7d02","tarball":"https://registry.npmjs.org/@dreamworld/event-emitter/-/event-emitter-1.1.0-webpack-compatible.1.tgz","fileCount":4,"unpackedSize":24514,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDOxnyaksI1O7pcoyiQgUlO3zycb9gU2OMyRxcY3e8/XAiEAowOMV77iMJmUd2OlSNyw7VTL+1xuFZgGk8vxEtxo1YY="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjB01dACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoLmw/6AxwkQA8dNx+Ye0bHpDDdotxjdjuQ2VOL0MQPUU5FsJ71uzSp\r\n2AJiDvEufkkykzeVayn+TAF8hA6XTXVZuFw1ztBjCn37p6jq5X4s/Dq5dd9q\r\nOJhhqy4O5aLoPbxKvXFx9lNgJuVqpOG2j3LfVUYVOWFTRIlzRrijsB4Hlg3I\r\nPf4VAQzZmiAxUAY6PjkemYLzv0kcbVWC1EjxXqpkYLxHic5BhE/lb6VEj+GL\r\nIG5+BZGElgpyVUucOqmkPzAX1WcA6Z4xpCbtfr+BQYW4bA107rsvtsvcVaNq\r\nCoESqS2AZaCzDb60hvwavFAvHD/zpM1kzH68hAAnW0XQHI8/Fm3QbWW0e/3R\r\nomAPV2FR81LciIB/B/hstfVpEtCS66ZpWueKwYfhsm5PJ+FYPpV2yXajl0H2\r\nlhyMXaCP2+8E+xDh7Wrhhh4e4m/3hUvnhjxyyUQy2NVraTBHt/tNlLVDNgxb\r\nA4VpmSsWQYAJwX38iFNv/HfOn1xbz08erYlj4m8LKK77F5O+e9aRGqXeFbf3\r\nKP4KU4F8wsyeGe8eU6g+pCK+FcHP8Nx+Jh6DR3b4a5c/iH6L+XFH7tYywQHf\r\n9myJs2NOrbIhTuy/BAv7ckyv/y0KvMB4xr4wXArVQ+dDLTcmUBAFGsUrr2AE\r\nyqhe4qvtSCeJRSvi2+yYJKWdPwzv2UmUpeI=\r\n=53kd\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dw-devops","email":"dreamworld.devops@gmail.com"},"directories":{},"maintainers":[{"name":"chiragmoradiya","email":"chirag@dreamworldsolutions.com"},{"name":"chetang7","email":"chetan@dreamworldsolutions.com"},{"name":"ajay-dhameliya","email":"ajay@dreamworldsolutions.com"},{"name":"dw-devops","email":"dreamworld.devops@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-emitter_1.1.0-webpack-compatible.1_1661422941253_0.5483087195349887"},"_hasShrinkwrap":false},"1.1.0-webpack-compatible1.1":{"name":"@dreamworld/event-emitter","version":"1.1.0-webpack-compatible1.1","description":"It's library by using we can bind event on any class instance","main":"event-emitter.js","type":"module","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/DreamworldSolutions/EventEmitter.git"},"keywords":["Event-Emitter","event"],"author":{"name":"Dhruval Kodinariya"},"license":"ISC","bugs":{"url":"https://github.com/DreamworldSolutions/EventEmitter/issues"},"homepage":"https://github.com/DreamworldSolutions/EventEmitter#readme","dependencies":{},"devDependencies":{"semantic-release":"17.0.8"},"publishConfig":{"access":"public"},"release":{"branches":["+([0-9])?(.{+([0-9]),x}).x","master",{"name":"feature/*","prerelease":"${name.replace(/^feature\\//g,\"\")}","channel":"${name.replace(/^feature\\//g,\"\")}"}]},"readme":"# EventEmitter\n\n## Use cases\n\n```javascript\nimport EventEmitter from  \"@dreamworld/event-emitter/event-emitter.js\";\n\n//This code simply creates an instance of EventEmitter to be used.\nvar ee = new EventEmitter();\n```\n### Adding listeners\n\nA listener is a function that is executed when an event is emitted. You can add them in a multitude of ways, the simplest of which is with the `addListener` method.\n\n```javascript\nfunction listener() {\n    console.log('The foo event has been emitted.');\n}\n\nee.addListener('foo', listener);\n```\n\nYou can also add in bulk using the `addListeners` method (notice the \"s\" on the end). You can interact with addListeners in two ways, the first is to pass it an event name and array of listeners to add.\n\n```javascript\nfunction listener1() {\n    console.log('ONE');\n}\n\nfunction listener2() {\n    console.log('TWO');\n}\n\nee.addListeners('foo', [listener1, listener2]);\n```\n\nThe second way of calling addListeners involves passing an object of event names and listeners. You can either pass a single listener for each event or an array, just as you can see above.\n\n```javascript\nfunction listener1() {\n    console.log('ONE');\n}\n\nfunction listener2() {\n    console.log('TWO');\n}\n\nfunction listener3() {\n    console.log('THREE');\n}\n\nee.addListeners({\n    foo: [listener1, listener2],\n    bar: listener3\n});\n```\n\n### Removing listeners\n\nThis works in the _exact_ same way as adding listeners. The only difference is that you replace the `add` in the method names with `remove`. Like this:\n\n```javascript\nfunction listener() {\n    console.log('The foo event has been emitted.');\n}\n\nee.addListener('foo', listener);\nee.removeListener('foo', listener);\n```\n\nIf you want a listener to remove itself after it has been called or after a condition has been met then all you need to do is return true.\n\n```javascript\nfunction listener1() {\n    // If a condition is met then remove the listener\n    if(completed) {\n        return true;\n    }\n}\n\nfunction listener2() {\n    // Always remove after use\n    return true;\n}\n\nee.addListeners('foo', [listener1, listener2]);\nee.emitEvent('foo');\n```\n\nIf you do not want to, or can't for some reason, return true, you can set the return value using `setOnceReturnValue`.\n\n```javascript\nfunction listener() {\n    // Always remove after use\n    return 'REMOVE-ME';\n}\n\nee.addListener('foo', listener);\nee.setOnceReturnValue('REMOVE-ME');\nee.emitEvent('foo');\n```\n\nAlternatively you can use the `addOnceListener` method, or it's alias, `once`.\n\n```javascript\nfunction listener() {\n    // Do stuff\n}\n\nee.addOnceListener('foo', listener);\nee.emitEvent('foo');\n// The listener will be removed now...\nee.emitEvent('foo');\n\n// The listener will only be executed once.\n```\n\nYou can also remove whole events and all of their attached listeners with the `removeEvent` method. If you pass an event name to the method then it will remove that event and it's listeners.\n\n```javascript\nfunction listener1() {\n    console.log('ONE');\n}\n\nfunction listener2() {\n    console.log('TWO');\n}\n\nee.addListeners('foo', [listener1, listener2]);\nee.removeEvent('foo');\n```\n\nHowever, if you leave it blank and do not pass an event name, then **all** events will be removed. It will wipe everything.\n\n### Fetching the listeners\n\nIf you really need to then you can get an array of all listeners attached to an event with the `getListeners` method.\n\n```javascript\nfunction listener1() {\n    console.log('ONE');\n}\n\nfunction listener2() {\n    console.log('TWO');\n}\n\nee.addListeners('foo', [listener1, listener2]);\nee.getListeners('foo');\n```\n\n### Emitting events\n\nSo once you have added your listeners and you are ready to start executing them, you can start to use the `emitEvent` method. At it's most basic level it will just execute all listeners attached to an event.\n\n```javascript\nfunction listener1() {\n    console.log('ONE');\n}\n\nfunction listener2() {\n    console.log('TWO');\n}\n\nee.addListeners('foo', [listener1, listener2]);\nee.emitEvent('foo');\n```\n\nFor more control, you can pass an arguments array as the second argument. This array will be applied to every listener as individual arguments.\n\n```javascript\nfunction adder(a, b) {\n    console.log(a + b);\n}\n\nee.addListener('addStuff', adder);\nee.emitEvent('addStuff', [10, 20]);\n```\n\n### Method aliases\n\n[Hebo](https://github.com/Hebo), from GitHub, [contributed three aliases](https://github.com/Olical/EventEmitter/pull/35#issuecomment-9920932) to add, remove and emit. The aliases can be found in the [API documentation](https://github.com/Olical/EventEmitter/blob/master/docs/api.md) but here is the mapping.\n\n * `on` - `addListener`\n * `off` - `removeListener`\n * `trigger` - `emitEvent`\n\nI've also added one since then.\n\n * `once` - `addOnceListener`\n\n### Using regular expressions\n\nYou can pass a regular expression to pretty much every function in EventEmitter in place of an event name string. So if you have two events, say, bar and baz, you can manipulate both of them with `/ba[rz]/`.\n\nThis applies to adding, removing and emitting events as well as a few others. There is one thing you have to remember when using this though, you must have the event defined before you use it in a regex.\n\nBy defined I mean, it has to have some other listener added to it, or you have to explicitly define it with the `defineEvent` / `defineEvents` functions. Here is an example of defining some events and adding to both with a regular expression.\n\n```javascript\nee.defineEvents(['bar', 'baz']);\nee.addListener(/ba[rz]/, function () {\n    console.log('Now you are thinking with regular expressions.');\n});\nee.emitEvent(/ba[rz]/);\n```\n\n## Extending with the EventEmitter class\n\nYou probably won't want to use EventEmitter as a raw class. You will probably want to write a `Player` class or something like that and implement EventEmitter's methods into it. To do this you will need to clone and merge EventEmitter's prototype object into your classes prototype object.\n\n```javascript\nclass Player(){}\n\nObject.assign(Player.prototype, EventEmitter.prototype);\n```","readmeFilename":"README.md","gitHead":"82569c9c46bc8bd074d59ba04b854ef09c6d7786","_id":"@dreamworld/event-emitter@1.1.0-webpack-compatible1.1","_nodeVersion":"16.13.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-FrW4VmF80gevkYF49uVvwwez/bXhCEWJDzeeRFZG0e70N2qt/tE5TYNVzxOPU07dUWFmx8FwS23Nbx0rJ4+qBA==","shasum":"4d4a9fb14519d9e8c2ba75284cbc8b0471bec78f","tarball":"https://registry.npmjs.org/@dreamworld/event-emitter/-/event-emitter-1.1.0-webpack-compatible1.1.tgz","fileCount":4,"unpackedSize":24515,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCnz/YhnjWvo7GIDbIYz+uto9nWv6zAGt0RDoCJ87XYYwIhAOcUAooVl0zzudthB7hqj8zbY8MP5tRC6wT7Fk621fcp"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjB2szACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr2kQ/9FbOoyo/yazrwDOAb31SBU0yjsJA1uISyO/JYAftaKrI4O+rT\r\nXhgOLXv4IOwpJbrG2SeiM7LYBAoNBEENe8XVe7BX2VJ1ltDQZ+L26d7hxcBr\r\n1GxjAl0ozowQp2/YA9cqXZYcer7xbEVFznCx6lRcAOvkRWIji/iFeqs1yesR\r\neksVPlh5/C05L95Eg9wy4ki3vz2VFa/LgW6w/ZW42ETcNKlH5CNjxbienZAR\r\nbQ+Yw2Eh+syMQnp4Xh7K6OLNbHhtpkGZAjuAKw8IJs5DKU1kl+I/c72aAsn5\r\nq/TtkWdpYJfgZ3yv1fztKYqSx0YvKdhc+wh93Ue0arHAVHEFM/Cn9TpK0N+S\r\nq5FUvNKPB+hT1KDYXyAzfpebYwjzMX3yNmoqfrJ3kvhAdrBQbKVWbuk5CSi3\r\nU928SOOck7iT1QTHkgMC14uphyIr4gz8yh4f1QG5Fbsnnzhz3Ebwf4CvpXOt\r\nqq25Yan/Q8YjsHwqM9bvfhzLC6qSN6lI8lt+LY8vqhPJlkNfscnc54BSTVa5\r\nsILlr7ZVh/34B7HuOdPdBSRPsfC/OpE3Wd9Cnb6jH81Yb571s0bJEFIcRrPi\r\nETX06iLZOQILrcopdEnGXaRoRjQGYYRv1w+e/a/PGo6pRsUq04d5r0dn+RdN\r\nkt9K0Ra5WoYyQhQijrLdy3HlfbgEPm5BUo8=\r\n=nUXI\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dw-devops","email":"dreamworld.devops@gmail.com"},"directories":{},"maintainers":[{"name":"chiragmoradiya","email":"chirag@dreamworldsolutions.com"},{"name":"chetang7","email":"chetan@dreamworldsolutions.com"},{"name":"ajay-dhameliya","email":"ajay@dreamworldsolutions.com"},{"name":"dw-devops","email":"dreamworld.devops@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-emitter_1.1.0-webpack-compatible1.1_1661430579726_0.767150970623548"},"_hasShrinkwrap":false},"1.1.0":{"name":"@dreamworld/event-emitter","version":"1.1.0","description":"It's library by using we can bind event on any class instance","main":"event-emitter.js","type":"module","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/DreamworldSolutions/EventEmitter.git"},"keywords":["Event-Emitter","event"],"author":{"name":"Dhruval Kodinariya"},"license":"ISC","bugs":{"url":"https://github.com/DreamworldSolutions/EventEmitter/issues"},"homepage":"https://github.com/DreamworldSolutions/EventEmitter#readme","dependencies":{},"devDependencies":{"semantic-release":"17.0.8"},"publishConfig":{"access":"public"},"release":{"branches":["+([0-9])?(.{+([0-9]),x}).x","master",{"name":"feature/*","prerelease":"${name.replace(/^feature\\//g,\"\")}","channel":"${name.replace(/^feature\\//g,\"\")}"}]},"gitHead":"5b0f960af1e8b1ca0d67d7a265179fe4ecfe0cb7","_id":"@dreamworld/event-emitter@1.1.0","_nodeVersion":"16.13.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-B2qURdBRBrr2+6figkq6a+eGtAcGANkYhqLGsrNEr8qePD6jWhGx9DZvw5ql1qLIne35b4VsheYLSh24ttQMxA==","shasum":"576af754e42abbbb24aee07e47f76d589656bd72","tarball":"https://registry.npmjs.org/@dreamworld/event-emitter/-/event-emitter-1.1.0.tgz","fileCount":4,"unpackedSize":24493,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGvPjPsxSB/MsBC5ufqQwZZguGgME+8PSsMfSEF9zM4DAiAixRMVE2KPKaskDMf65VPWXDpKOt5NFueO45o3HPSAEQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjB2t+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqXTg//dZIoRr3Y4Y5BEIMFLXHIAkbAqDH31EElf2/sEJjHlgn1oz7y\r\nlPZj1GlqOYjI2QTzP/Ysan+1li/ZV+5u7+V2bLLYNYncbaCvIM++n/+epoPm\r\ncP1I53Q0H+arFMneemCO2BzpjX9rdsLRmmxkoukLoqrnamfcp7oRtBUlMmeY\r\nTIqEkRJWZqm90egoj8fgl38GKVEby7OstUYWsL/afu8IF4rlHGS5FeEyOJN2\r\nf/ljEuKooiODxgpVt2sbqmqZGxRwJX+ulrTIoZeTKNbsVKazU5de7cWFseXb\r\nYuTVzxrI73ncwFRyib+7O/4Nl8xxPMQRphWnyYiODP0j8Cp8aaxtptb49r/R\r\n5B4xTgwOt4n7txstHrLtaJZ1JA8v53jrNsOT92D5Iqlh4OP1qMwztw4w4oLE\r\nq5hKsCDwJfzqYN3LAKcglzZFgFqPzHfSi7uOLMU6Z5556SVE5ZKqdM1PN+Co\r\nUtzpGMkQLdu2QidGIZog0SIzmGa+NYM5a3HWLZJQ5yhfxSbJGxzASdIyBinZ\r\nBRXY8O3vpAcYfK8DirL07e9gOvz6apJn7zCXIcvfUtmjtvESXRxnvzTwBu3A\r\nUyA34Uhe2Q42bL6hT+5Jg9VF2JSxWEZM3mA/XSyNZIzZTbk2H5sFJVmfvcy4\r\nZjKNmtIovPY8dMRbJHiHG+6ifQ9oCRxKy3k=\r\n=T4sp\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dw-devops","email":"dreamworld.devops@gmail.com"},"directories":{},"maintainers":[{"name":"chiragmoradiya","email":"chirag@dreamworldsolutions.com"},{"name":"chetang7","email":"chetan@dreamworldsolutions.com"},{"name":"ajay-dhameliya","email":"ajay@dreamworldsolutions.com"},{"name":"dw-devops","email":"dreamworld.devops@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-emitter_1.1.0_1661430653777_0.9231893210531312"},"_hasShrinkwrap":false}},"time":{"created":"2020-12-17T08:43:01.886Z","1.0.0":"2020-12-17T08:43:02.257Z","modified":"2022-08-25T12:30:54.128Z","1.1.0-webpack-compatible.1":"2022-08-25T10:22:21.371Z","1.1.0-webpack-compatible1.1":"2022-08-25T12:29:39.883Z","1.1.0":"2022-08-25T12:30:54.023Z"},"maintainers":[{"name":"chiragmoradiya","email":"chirag@dreamworldsolutions.com"},{"name":"chetang7","email":"chetan@dreamworldsolutions.com"},{"name":"ajay-dhameliya","email":"ajay@dreamworldsolutions.com"},{"name":"dw-devops","email":"dreamworld.devops@gmail.com"}],"description":"It's library by using we can bind event on any class instance","homepage":"https://github.com/DreamworldSolutions/EventEmitter#readme","keywords":["Event-Emitter","event"],"repository":{"type":"git","url":"git+https://github.com/DreamworldSolutions/EventEmitter.git"},"author":{"name":"Dhruval Kodinariya"},"bugs":{"url":"https://github.com/DreamworldSolutions/EventEmitter/issues"},"license":"ISC","readme":"# EventEmitter\n\n## Use cases\n\n```javascript\nimport EventEmitter from  \"@dreamworld/event-emitter/event-emitter.js\";\n\n//This code simply creates an instance of EventEmitter to be used.\nvar ee = new EventEmitter();\n```\n### Adding listeners\n\nA listener is a function that is executed when an event is emitted. You can add them in a multitude of ways, the simplest of which is with the `addListener` method.\n\n```javascript\nfunction listener() {\n    console.log('The foo event has been emitted.');\n}\n\nee.addListener('foo', listener);\n```\n\nYou can also add in bulk using the `addListeners` method (notice the \"s\" on the end). You can interact with addListeners in two ways, the first is to pass it an event name and array of listeners to add.\n\n```javascript\nfunction listener1() {\n    console.log('ONE');\n}\n\nfunction listener2() {\n    console.log('TWO');\n}\n\nee.addListeners('foo', [listener1, listener2]);\n```\n\nThe second way of calling addListeners involves passing an object of event names and listeners. You can either pass a single listener for each event or an array, just as you can see above.\n\n```javascript\nfunction listener1() {\n    console.log('ONE');\n}\n\nfunction listener2() {\n    console.log('TWO');\n}\n\nfunction listener3() {\n    console.log('THREE');\n}\n\nee.addListeners({\n    foo: [listener1, listener2],\n    bar: listener3\n});\n```\n\n### Removing listeners\n\nThis works in the _exact_ same way as adding listeners. The only difference is that you replace the `add` in the method names with `remove`. Like this:\n\n```javascript\nfunction listener() {\n    console.log('The foo event has been emitted.');\n}\n\nee.addListener('foo', listener);\nee.removeListener('foo', listener);\n```\n\nIf you want a listener to remove itself after it has been called or after a condition has been met then all you need to do is return true.\n\n```javascript\nfunction listener1() {\n    // If a condition is met then remove the listener\n    if(completed) {\n        return true;\n    }\n}\n\nfunction listener2() {\n    // Always remove after use\n    return true;\n}\n\nee.addListeners('foo', [listener1, listener2]);\nee.emitEvent('foo');\n```\n\nIf you do not want to, or can't for some reason, return true, you can set the return value using `setOnceReturnValue`.\n\n```javascript\nfunction listener() {\n    // Always remove after use\n    return 'REMOVE-ME';\n}\n\nee.addListener('foo', listener);\nee.setOnceReturnValue('REMOVE-ME');\nee.emitEvent('foo');\n```\n\nAlternatively you can use the `addOnceListener` method, or it's alias, `once`.\n\n```javascript\nfunction listener() {\n    // Do stuff\n}\n\nee.addOnceListener('foo', listener);\nee.emitEvent('foo');\n// The listener will be removed now...\nee.emitEvent('foo');\n\n// The listener will only be executed once.\n```\n\nYou can also remove whole events and all of their attached listeners with the `removeEvent` method. If you pass an event name to the method then it will remove that event and it's listeners.\n\n```javascript\nfunction listener1() {\n    console.log('ONE');\n}\n\nfunction listener2() {\n    console.log('TWO');\n}\n\nee.addListeners('foo', [listener1, listener2]);\nee.removeEvent('foo');\n```\n\nHowever, if you leave it blank and do not pass an event name, then **all** events will be removed. It will wipe everything.\n\n### Fetching the listeners\n\nIf you really need to then you can get an array of all listeners attached to an event with the `getListeners` method.\n\n```javascript\nfunction listener1() {\n    console.log('ONE');\n}\n\nfunction listener2() {\n    console.log('TWO');\n}\n\nee.addListeners('foo', [listener1, listener2]);\nee.getListeners('foo');\n```\n\n### Emitting events\n\nSo once you have added your listeners and you are ready to start executing them, you can start to use the `emitEvent` method. At it's most basic level it will just execute all listeners attached to an event.\n\n```javascript\nfunction listener1() {\n    console.log('ONE');\n}\n\nfunction listener2() {\n    console.log('TWO');\n}\n\nee.addListeners('foo', [listener1, listener2]);\nee.emitEvent('foo');\n```\n\nFor more control, you can pass an arguments array as the second argument. This array will be applied to every listener as individual arguments.\n\n```javascript\nfunction adder(a, b) {\n    console.log(a + b);\n}\n\nee.addListener('addStuff', adder);\nee.emitEvent('addStuff', [10, 20]);\n```\n\n### Method aliases\n\n[Hebo](https://github.com/Hebo), from GitHub, [contributed three aliases](https://github.com/Olical/EventEmitter/pull/35#issuecomment-9920932) to add, remove and emit. The aliases can be found in the [API documentation](https://github.com/Olical/EventEmitter/blob/master/docs/api.md) but here is the mapping.\n\n * `on` - `addListener`\n * `off` - `removeListener`\n * `trigger` - `emitEvent`\n\nI've also added one since then.\n\n * `once` - `addOnceListener`\n\n### Using regular expressions\n\nYou can pass a regular expression to pretty much every function in EventEmitter in place of an event name string. So if you have two events, say, bar and baz, you can manipulate both of them with `/ba[rz]/`.\n\nThis applies to adding, removing and emitting events as well as a few others. There is one thing you have to remember when using this though, you must have the event defined before you use it in a regex.\n\nBy defined I mean, it has to have some other listener added to it, or you have to explicitly define it with the `defineEvent` / `defineEvents` functions. Here is an example of defining some events and adding to both with a regular expression.\n\n```javascript\nee.defineEvents(['bar', 'baz']);\nee.addListener(/ba[rz]/, function () {\n    console.log('Now you are thinking with regular expressions.');\n});\nee.emitEvent(/ba[rz]/);\n```\n\n## Extending with the EventEmitter class\n\nYou probably won't want to use EventEmitter as a raw class. You will probably want to write a `Player` class or something like that and implement EventEmitter's methods into it. To do this you will need to clone and merge EventEmitter's prototype object into your classes prototype object.\n\n```javascript\nclass Player(){}\n\nObject.assign(Player.prototype, EventEmitter.prototype);\n```","readmeFilename":"README.md"}