{"_id":"@axel669/event-bridge","_rev":"3-fed421f4c9e6562e092d9e2481dd3ab7","name":"@axel669/event-bridge","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@axel669/event-bridge","version":"1.0.0","description":"pubsub-ish event emitter for node/browser with some neat features","main":"index.js","scripts":{"build":"rollup -c","test":"node test/node/basic.test.js"},"keywords":["event","emitter","pubsub","bridge"],"author":{"name":"Axel"},"license":"MIT","devDependencies":{"rollup":"^2.69.2"},"licenseText":"MIT License\n\nCopyright (c) 2022 Chris Morgan\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"@axel669/event-bridge@1.0.0","dist":{"shasum":"6a8dd7761f8d24b6a04698940ab0e3369528be3f","integrity":"sha512-BRGkmz4wc1tsmm8ilA6C5ejY/PPDgQKTVc1MMGMqRKGwJwkPrTd/s9CVUDrL9qNBkcbM22Z7inVQYK4C+K3QJw==","tarball":"https://registry.npmjs.org/@axel669/event-bridge/-/event-bridge-1.0.0.tgz","fileCount":17,"unpackedSize":21331,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiJl+4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoFBxAAlfgGQ1h5OGmmBLjfSA4MXmE7Yd3zKk6lYc45IOAJuMC3gmYB\r\ncmtidlXVVx37ttafpraWh9ehIEDfMvLfdApAiGpwW7tnjTptyT+xMR9P3wH5\r\nqsEIzneTLdz7Y2yOfyE6Rm8wVOJoruxTkeIywVxl3aImxI/v49ZRfXfgbqCx\r\nFaG5WWYaSV0xtqvyrYqQoOTznDKL4bZCYo7YEpaQdwMCG9lzv1RTjRevGSWi\r\nstHDwplN2/bHn0OZ1MwkuWmxaQE0SMn0xS8Ji2m732nSeOSqAw9EzXYO7fCq\r\nFLeYhzW6jVIV1tJh6rx4bp/z6q7u5aXXTwy12+41et13YP17IyBmxaR6kG2s\r\ny+JjoWLhsUJpmwGtAOzGuspGoK+AYrNnpjS6kLFlp2+Wyx4zzI4oxDAFdRPo\r\nSbDilOl6UvXNR2j9gmvg/0cJFqKJnGXAXKWPyEmJdJ5QwBB7i+/ecgQ870+0\r\nA2hxqFqAB04YPnmzBpSWHcN9g9LC6DPxV3KoCK3lWWhejqGfs/ifzDak6ALb\r\nPahmEfNQsZr3C+zZfE+VqFbpS8qNlRucoJzy61NyCmnV3d3Zq9kDbh85jm6v\r\nw59+/F5mlMy4YPLgY0pzyB3wyZOLp4sZ8hcGntnIusV6Eeab4HBUTp5DxQlc\r\nC2am4KohZV+DaJrCXzi7yHlPOpMO74mM0Ww=\r\n=cBIo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCBQQ6SWWG38K+AtemFg+VUB4LRA3dJmZV0Yrj0PyO6fQIgPgPyj3i0txWA54PmnJxzrquWzSvZH9ulpZAzay+uZL4="}]},"_npmUser":{"name":"axel669","email":"axel@axel669.net"},"directories":{},"maintainers":[{"name":"axel669","email":"axel@axel669.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-bridge_1.0.0_1646682040631_0.689656550385686"},"_hasShrinkwrap":false},"1.0.1":{"name":"@axel669/event-bridge","version":"1.0.1","description":"pubsub-ish event emitter for node/browser with some neat features","main":"index.js","scripts":{"build":"rollup -c","test":"node test/node/basic.test.js"},"keywords":["event","emitter","pubsub","bridge"],"author":{"name":"Axel"},"license":"MIT","devDependencies":{"rollup":"^2.69.2"},"licenseText":"MIT License\n\nCopyright (c) 2022 Chris Morgan\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"@axel669/event-bridge@1.0.1","dist":{"shasum":"327b642a8a1104e3a937e2f6f7288e86497ba288","integrity":"sha512-4DRJ5+vhUAJDCkco+5neqbDrccEzjfbzdt5R2tScT+60H5RqsR7DJAPWc3Bdvo9vldWsT0ZUxgneEFxwiXRwsQ==","tarball":"https://registry.npmjs.org/@axel669/event-bridge/-/event-bridge-1.0.1.tgz","fileCount":17,"unpackedSize":21332,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiJmIeACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrxFA/+MN/e9t1UZGlMvTcV6QwbpaZlaGVk8FP3avYWP8/zs5f8dcpT\r\nG8kbb8KGiZCGo0DMGGBjM+Cj/PgwkuofG2oma3KnhmBArR05nd8A4bQAqkRI\r\nfPgIkiI+dDsHpw68KIV+CY7gvCCsCNUzeYWei6ECVzNhjlr+o5z5mFrJF2wP\r\nT0CHIaL6O35ZBsZYpRHqBEhvCnyhJcDk821zRhysrl2Q3WNtrEij1VOyOtDA\r\nSyEJO267+g+LsbNhF3bJ8x6E8AY8B7uEq2ApB8/w3xRa0KgVEEJUKDGSZ/rX\r\nEiaxEZZCXuFJrhBfKNbcCudaWVPhwxmnuuOXFMuTNu02NWCp32dHH7tOYZU3\r\nezKI8K6J0Mk+hqhK8zAWPgecPLNYGB7L56rjH0mmCczKBodxIRFslfoesZ92\r\nw0egZ0LOGqYb4+7c3537u5MtcymXGmFgR5As8ST38rIbztbWqSR8M+1K/uKF\r\negJlP4AEk1qzngAPLay/NydTvIMMp7enhXihLyCfETcCr2vWA45PwTV79L5a\r\n6hx0OATryw/hX7jXDBS6Idh21df3qbf+Xe4uNg+atinOo6jjVRokP54O3Zcw\r\nAhOCAqVZUWvbRgd9nFJgquZOOq3MVXHpiKYvaIb35bXnrUIisJhQo/H6z2qk\r\nG8Km6zNtu+jNP7cdyg2GXSXpThhZm86YmqQ=\r\n=Ct16\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBnG0OAp8bBZGQML6vtVOwCy5fbc3HL+j1Lb2sWuQfUrAiA8hUHsoDg3f1yaadPSIk62NAQSZpTZNH9ST8gc4m2zUA=="}]},"_npmUser":{"name":"axel669","email":"axel@axel669.net"},"directories":{},"maintainers":[{"name":"axel669","email":"axel@axel669.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-bridge_1.0.1_1646682654408_0.8507659664638068"},"_hasShrinkwrap":false},"1.0.2":{"name":"@axel669/event-bridge","version":"1.0.2","description":"pubsub-ish event emitter for node/browser with some neat features","main":"index.js","scripts":{"build":"rollup -c","test":"node test/node/basic.test.js"},"keywords":["event","emitter","pubsub","bridge"],"author":{"name":"Axel"},"license":"MIT","devDependencies":{"rollup":"^2.69.2"},"licenseText":"MIT License\n\nCopyright (c) 2022 Chris Morgan\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"@axel669/event-bridge@1.0.2","dist":{"shasum":"43da1537d1f7bc243dfda3928771a6aa8216e0c3","integrity":"sha512-xTnGEjDst6xL4js5ZWsSTHPBL2E0C+umPhRKMYDuH0EaZuCLa5SJyLj5WVX9Y575D9dkEOI8F1B9qCvAWFN1XA==","tarball":"https://registry.npmjs.org/@axel669/event-bridge/-/event-bridge-1.0.2.tgz","fileCount":17,"unpackedSize":22145,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiKBgpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrsbhAAjITjHvujLcJ5YyJo2eGYubQiSOQ7qGZkIRCl0MOyghDwWYX7\r\nKzFkQpqnygun+iUL5ke6WNnNY5M7nA/k+SCKYfwHCueUoGLiFZxclh9H5imw\r\n2hgLk9jJ02VNdMENkWKhd05IclH4rJ8NABiEFcmKoZaruQGhdpQhPCVgLMS0\r\nSu+SC1uPQbnVz3FlPV0rLA3t+/7eYhHM6uGQikqH7kUozXhDACtWc+c6qcbW\r\nfs9wWOJ/SDGTck+jzIDZDP8GJMHg0NBA2spHqPR7JC2KIKO+MMPpSol9GVx8\r\ncMggg/WZ0tjcZUBwyKiY4sOrgBs7STWFVV+XQQe5JDoQqw0lEq+0tMU5V3m9\r\npQdTE8dUdeI07cOTk5W2o19yEw3vCKf5COLu7ApQoKYC/tKwWn+TlQ2i+99R\r\noCTRJ4JVFzj5w1AhCGFdMNsflNLemoJ9HmmwQqD/dJi4N2Tz/4iQ/1btNNXT\r\nYV4O66IFu3YrtLfXUZ2jrVQvo+JHXhiEenQXHriofFadpK71nOpNLOY1HuUB\r\nP6Qp8zzc5qyBdulEOjTHywYMcefwKo/DFzPdtTleuVZXQ/kwKSug4tFGQfm9\r\njTR1fa6emwlIF/pr0VF74QRDlO5T6iGbQBYR2q1miTzH049K6Z/bzNaX6e5R\r\nstW8U3XBKYe3s7ya5wzRyklfcaMgijnsh3M=\r\n=77/l\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCs2iWz7X1ac2cEh2vCMMBG2+zEMj63r3w49C4ggkGyIwIhAMqU5I2eFvGwIEH2Rn3lJji2nrhklwN1rKCRHB9pQaUz"}]},"_npmUser":{"name":"axel669","email":"axel@axel669.net"},"directories":{},"maintainers":[{"name":"axel669","email":"axel@axel669.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/event-bridge_1.0.2_1646794793352_0.6932108554497118"},"_hasShrinkwrap":false}},"time":{"created":"2022-03-07T19:40:40.585Z","1.0.0":"2022-03-07T19:40:40.947Z","modified":"2022-04-04T17:08:52.130Z","1.0.1":"2022-03-07T19:50:54.565Z","1.0.2":"2022-03-09T02:59:53.595Z"},"maintainers":[{"name":"axel669","email":"axel@axel669.net"}],"description":"pubsub-ish event emitter for node/browser with some neat features","keywords":["event","emitter","pubsub","bridge"],"author":{"name":"Axel"},"license":"MIT","readme":"# EventBridge\n> A pubsub-like event emitter with neat features for node & browser\n\n## Installation\n\n### Yarn\n```bash\nyarn install @axel669/event-bridge\n```\n\n### Browser (Standalone)\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/@axel669/event-bridge/dist/event-bridge.js\"></script>\n```\n\n## API\n\n### on(type, listener)\n- `type:String` The type of events to listen for\n- `listener:Function` The listener function\nAdds and event listener. Returns a function that removes the listeners.\n\n### once(type, listener)\n- `type:String` The type of events to listen for\n- `listener:Function` The listener function\nAdds and event listener that is only triggered once. Returns a function that\nremoves the listener if it hasn't been fired (and just does a noop if the\nlistener has been triggered).\n\n### emit(type, data)\n- `type:String` The type of event to trigger\n- `data:Any` Data to attach to the event\nEmits an event to the appropriate listeners.\n\n### pull(source, prefix)\n- `source:EventBridge` The EventBridge to pull events from\n- `prefix:String` *Optional* A prefix to attach to the event type when\n    pulling. If nothing is given, will use the exact event type.\nPulls all events from the given bridge to the current one. Returns a function\nto cancel the pulling (like the on function).\n\n### bind(source, types)\n- `source:EventEmitter` The source to pull events from. An EventEmitter is any\n    object that has `addEventListener` and `removeEventListener` functions.\n- `type:Array[String]` The list of event types to pull from the source\nPulls events from the source and passes them into the EventBridge. Returns a\nfunction that stops the event pulling.\n\n### removeAll()\nRemoves all listeners for all events on the EventBridge.\n\n### Usage\n```js\nimport EventBridge from \"@axel669/event-bridge\"\n\n//  new is not required\nconst bridge = EventBridge()\n\n//  standard event emitter stuff\nbridge.on(\"demo\", listener)\n//  namespaced events\nbridge.on(\"demo.nested\", listener)\n//  wildcard events\nbridge.on(\"demo.*\", listener)\n\n//  will trigger the demo.nested and demo.* listeners\nbridge.emit(\"demo.nested\", data)\n\nconst allEvents = EventBridge()\nbridge.forward(allEvents)\nallEvents.pull(window, [\"click\", \"mousemove\"])\n\nallEvents.on(\"mousemove\", something)\nallEvents.on(\"demo.*\", something)\n\nbridge.removeAll()\n```\n\n### Event Trigger Path\nEvents fired will fire upward through the namespaces as well in a very specific\nway, which can be seen using `EventBridge.tracePath(type)`. Listeners are fired\nfrom most specific to least specific, and only wildcard listeners for namespaces\nare triggered for things inside the namespace. All events can be listened for\nusing the `\"*\"` type, as all paths end with it.\n\n#### Examples\n```js\n\"demo\"\n> [\"demo\", \"*\"]\n\n\"demo.nested\"\n> [\"demo.nested\", \"demo.*\", \"*\"]\n\n\"demo.nested.again\"\n> [\"demo.nested.again\", \"demo.nested.*\", \"demo.*\", \"*\"]\n```\n","readmeFilename":"README.md"}