{"id":18096225,"url":"https://github.com/bredele/zeroin","last_synced_at":"2025-04-13T10:05:25.389Z","repository":{"id":57405663,"uuid":"163871566","full_name":"bredele/zeroin","owner":"bredele","description":"The only Event Emitter you need","archived":false,"fork":false,"pushed_at":"2019-01-04T22:18:21.000Z","size":46,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T03:29:16.467Z","etag":null,"topics":["event-emitter","publish-subscribe"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bredele.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-02T17:48:08.000Z","updated_at":"2024-02-23T19:34:42.000Z","dependencies_parsed_at":"2022-09-26T17:01:43.610Z","dependency_job_id":null,"html_url":"https://github.com/bredele/zeroin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bredele%2Fzeroin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bredele%2Fzeroin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bredele%2Fzeroin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bredele%2Fzeroin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bredele","download_url":"https://codeload.github.com/bredele/zeroin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248695438,"owners_count":21146954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["event-emitter","publish-subscribe"],"created_at":"2024-10-31T19:13:04.870Z","updated_at":"2025-04-13T10:05:25.360Z","avatar_url":"https://github.com/bredele.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/bredele/zeroin/blob/master/zeroin.png\" width=\"300\" height=\"220\" alt=\"zeroin\"\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://www.npmjs.org/package/zeroin\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/zeroin.svg?style=flat\" alt=\"npm\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://travis-ci.org/bredele/zeroin\"\u003e\u003cimg src=\"https://travis-ci.org/bredele/zeroin.svg?branch=master\" alt=\"travis\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://david-dm.org/bredele/zeroin\"\u003e\u003cimg src=\"https://david-dm.org/bredele/zeroin/status.svg\" alt=\"dependencies Status\"\u003e\u003c/a\u003e\n  \u003ca href='https://github.com/bredele/contributing-guide/blob/master/guidelines.m'\u003e\u003cimg src=\"https://bredele.github.io/contributing-guide/community-pledge.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# Zeroin\n\nZeroin is a tiny functional event emitter made for the browser and 100% compatible with [Node's EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter).\n\n-   **Functional:** methods don't rely on `this`\n-   **Compatible:** exact same API than Nodejs event emitters\n-   **Asynchronous:** create promises from a listener\n-   **Useful:** use the wildcard `\"*\"` to listens for all events\n-   **Small:** weighs less than 800 bytes gzipped\n\nZeroin has no dependencies and works in all mainstream browsers, included IE9+.\n\n## Usage\n\nBasic API.\n\n```js\nconst zeroin = require('zeroin')\n\n// create new event emitter\nconst emitter = zeroin()\n\n// listen to an event\nvar handler = value =\u003e console.log(value)\nemitter.on('hello', handler)\n\n// listen to an event once\nemitter.once('hello', handler)\n\n// listen to all events\nemitter.on('*', (type, value) =\u003e console.log(type, value))\n\n// emit an event\nemitter.emit('hello', 'world')\n\n// remove all listeners for a given type\nemitter.off('hello')\n// remove specific listener\nemitter.off('hello', handler)\n// remove all listeners\nemitter.off()\n\n```\n\nWhat makes zeroin special.\n\n```js\n\nconst emitter = {}\n\n// mixin object with zeroin API\nzeroin(emitter)\n\n// listen to an event and pass all the values associated to it\nemitter.on('hello', (...values) =\u003e console.log(...values))\n\n// prepend listener with .on or .once\nemitter.on('hello', () =\u003e console.log('do something'), true)\nemitter.once('hello', () =\u003e console.log('do something'), true)\n\n// promises can be created from .on or .once\nemitter.on('hello').then((...values) =\u003e console.log(...values))\nemitter.once('hello').then((...values) =\u003e console.log(...values))\n\n\n// emit an event and pass multiple values\nemitter.emit('hello', 'world', 'universe')\n\n```\n\n\n## Installation\n\n```shell\nnpm install zeroin --save\n```\n\n[![NPM](https://nodei.co/npm/zeroin.png)](https://nodei.co/npm/zeroin/)\n\n\n## Question\n\nFor questions and feedback please use our [twitter account](https://twitter.com/bredeleca). For support, bug reports and or feature requests please make sure to read our\n\u003ca href=\"https://github.com/bredele/contributing-guide/blob/master/guidelines.md\" target=\"_blank\"\u003ecommunity guideline\u003c/a\u003e and use the issue list of this repo and make sure it's not present yet in our reporting checklist.\n\n## Contribution\n\nzeroin is an open source project and would not exist without its community. If you want to participate please make sure to read our \u003ca href=\"https://github.com/bredele/contributing-guide/blob/master/guidelines.md\" target=\"_blank\"\u003eguideline\u003c/a\u003e before making a pull request. If you have any zeroin related project, component or other let everyone know in our wiki.\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2016 Olivier Wietrich\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbredele%2Fzeroin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbredele%2Fzeroin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbredele%2Fzeroin/lists"}