{"id":13827852,"url":"https://github.com/egoist/eventstop","last_synced_at":"2025-08-21T19:30:56.157Z","repository":{"id":41207586,"uuid":"78025788","full_name":"egoist/eventstop","owner":"egoist","description":"A minimal event library for Node.js and browser.","archived":false,"fork":false,"pushed_at":"2021-12-25T14:02:19.000Z","size":47,"stargazers_count":115,"open_issues_count":1,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-12-10T10:04:52.220Z","etag":null,"topics":[],"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/egoist.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":"2017-01-04T15:05:51.000Z","updated_at":"2022-08-17T12:57:13.000Z","dependencies_parsed_at":"2022-08-26T19:21:40.301Z","dependency_job_id":null,"html_url":"https://github.com/egoist/eventstop","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Feventstop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Feventstop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Feventstop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/egoist%2Feventstop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/egoist","download_url":"https://codeload.github.com/egoist/eventstop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230527875,"owners_count":18240052,"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":[],"created_at":"2024-08-04T09:02:15.679Z","updated_at":"2024-12-20T03:10:33.736Z","avatar_url":"https://github.com/egoist.png","language":"JavaScript","readme":"# eventstop\n\n[![NPM version](https://img.shields.io/npm/v/eventstop.svg?style=flat)](https://npmjs.com/package/eventstop) [![NPM downloads](https://img.shields.io/npm/dm/eventstop.svg?style=flat)](https://npmjs.com/package/eventstop) [![Build Status](https://img.shields.io/circleci/project/egoist/eventstop/master.svg?style=flat)](https://circleci.com/gh/egoist/eventstop) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000\u0026style=flat)](https://github.com/egoist/donate)\n\n## Features\n\n- Modern\n- For Node.js and browsers\n- Support wildcard listener: `on('*', (type, ...payload) =\u003e {})`\n- Support all major browsers including IE8\n- 300 bytes minified and gzipped\n\n## Install\n\n```bash\nyarn add eventstop\n```\n\nYou can also use the UMD version via https://unpkg.com/eventstop\n\n## Usage\n\n```js\nconst eventstop = require('eventstop')\n\nconst {on, emit} = eventstop()\n\n// subscribe an event\nconst off = on('ready', msg =\u003e {\n  console.log('message:', msg)\n})\n\nemit('ready', 'hola')\n//=\u003e hola\n\n// unsubscribe\noff()\n```\n\n## API\n\n```js\nconst event = eventstop()\n// or\nconst {on, off, emit, once} = eventstop()\n```\n\n### .on(event, handler)\n\nReturn a function which would execute `off(event, handler)` when you call it.\n\nYou can use `*` as event type to listen all types:\n\n```js\non('*', (type, foo, bar) =\u003e {\n  console.log(type, foo, 'and', bar)\n  //=\u003e hello you and me\n})\nemit('hello', 'you', 'me')\n```\n\nIn wildcard listener, the first argument of handler function is its **type**.\n\n### .once(event, handler)\n\nLike `.on` but only trigger `handler` once.\n\n#### event\n\nType: `string`\n\n#### handler\n\nType: `function`\n\n### .emit(event, ...args)\n\n#### event\n\nType: `string`\n\n### .off(event, handler)\n\nSame args to `.on`\n\n## Contributing\n\n1. Fork it!\n2. Create your feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n\n\n## Author\n\n**eventstop** © [egoist](https://github.com/egoist), Released under the [MIT](./LICENSE) License.\u003cbr\u003e\nAuthored and maintained by egoist with help from contributors ([list](https://github.com/egoist/eventstop/contributors)).\n\n\u003e [egoistian.com](https://egoistian.com) · GitHub [@egoist](https://github.com/egoist) · Twitter [@_egoistlily](https://twitter.com/_egoistlily)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegoist%2Feventstop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fegoist%2Feventstop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fegoist%2Feventstop/lists"}