{"id":39766770,"url":"https://github.com/beefchimi/emitten","last_synced_at":"2026-01-18T11:45:38.677Z","repository":{"id":65496478,"uuid":"592502026","full_name":"beefchimi/emitten","owner":"beefchimi","description":"A barebones event emitter written in TypeScript","archived":false,"fork":false,"pushed_at":"2024-08-18T21:53:28.000Z","size":636,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T19:41:36.172Z","etag":null,"topics":["emitter","event","events","typescript"],"latest_commit_sha":null,"homepage":"https://dulmage.me","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beefchimi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-23T21:32:42.000Z","updated_at":"2024-08-18T21:53:04.000Z","dependencies_parsed_at":"2023-03-05T06:30:22.215Z","dependency_job_id":"23f03042-e826-4605-a132-6b8b7f80bf3c","html_url":"https://github.com/beefchimi/emitten","commit_stats":{"total_commits":61,"total_committers":2,"mean_commits":30.5,"dds":0.3278688524590164,"last_synced_commit":"b23dbcdfe26e4b2ade696f12b472ac615c61338d"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":"beefchimi/template-common","purl":"pkg:github/beefchimi/emitten","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beefchimi%2Femitten","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beefchimi%2Femitten/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beefchimi%2Femitten/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beefchimi%2Femitten/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beefchimi","download_url":"https://codeload.github.com/beefchimi/emitten/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beefchimi%2Femitten/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28535177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T10:13:46.436Z","status":"ssl_error","status_checked_at":"2026-01-18T10:13:11.045Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["emitter","event","events","typescript"],"created_at":"2026-01-18T11:45:37.908Z","updated_at":"2026-01-18T11:45:38.668Z","avatar_url":"https://github.com/beefchimi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Emitten\n\n[![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)\n\n\u003e `Emitten` is a very basic event emitter for TypeScript.\n\nThis simple `class` allows you to subscribe/unsubscribe to a defined library of events.\n\n## Get started\n\nAdd `Emitten` to your project.\n\n```sh\n# Using NPM\nnpm install emitten\n\n# Or some other package manager, such as Yarn\nyarn add emitten\n```\n\nImport and start emit’in!\n\n```ts\n// Import the fully public Emitten variant.\n// Alternatively, use the fully protected variant: EmittenProtected\n// Or, the partially protected variant: EmittenCommon\nimport {Emitten} from 'emitten';\n\n// Define your “event map” of `eventName: listener(args)` pairs.\n// Both the `eventName` and the `args` from the `listener` are\n// captured by TypeScript to assert type-safety!\ntype EventMap = {\n  change: (value: string) =\u003e void;\n  count: (value?: number) =\u003e void;\n  collect: (...values: boolean[]) =\u003e void;\n  other: (required: string, ...optional: string[]) =\u003e void;\n};\n\n// Instantiate, passing `EventMap` as a generic.\nconst myEmitter = new Emitten\u003cEventMap\u003e();\n\n// By referencing the `EventMap` you created,\n// you can assign the correct type to your listeners.\nconst handleChange: EventMap['change'] = (value) =\u003e {};\n\n// Register a subscription!\nmyEmitter.on('change', handleChange);\n\n// Emit an event! The arguments accepted\n// by `.emit()` will be correctly typed.\nmyEmitter.emit('change', 'Hello world');\n\n// Remove a subscription!\nmyEmitter.off('change', handleChange);\n\n// Register a subscription only once! The listener\n// will be automatically removed after a single `emit`.\nmyEmitter.once('count', (value = 0) =\u003e {});\nmyEmitter.emit('count', 123);\n\n// Capture and manually call the removal function!\n// The arguments accepted by any listener will correctly\n// correspond with the registered `eventName`.\nconst dispose = myEmitter.on('collect', (...values) =\u003e {});\nmyEmitter.emit('collect', true, false, !true, !false);\n\ndispose();\n\n// Get a list of all the events that currently\n// have subscriptions.\nconst currentEvents = myEmitter.activeEvents;\n\n// Remove all registered listeners!\nmyEmitter.empty();\n```\n\nFor more guidance, please take a look at the [`Examples document`](./docs/examples.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeefchimi%2Femitten","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeefchimi%2Femitten","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeefchimi%2Femitten/lists"}