{"id":16223450,"url":"https://github.com/so1ve/lite-emit","last_synced_at":"2025-03-19T12:30:26.543Z","repository":{"id":56715169,"uuid":"523189539","full_name":"so1ve/lite-emit","owner":"so1ve","description":"A simple, lightweight, and fast event emitter.","archived":false,"fork":false,"pushed_at":"2025-03-08T08:24:34.000Z","size":968,"stargazers_count":13,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T18:14:22.079Z","etag":null,"topics":["emit","emits","emits-events","emitter","events","nodejs","pubsub"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/so1ve.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://afdian.net/@so1ve"]}},"created_at":"2022-08-10T03:41:06.000Z","updated_at":"2025-01-27T06:56:50.000Z","dependencies_parsed_at":"2023-01-28T12:25:15.848Z","dependency_job_id":"7507dbbd-38be-4c20-8e78-7687d07e8445","html_url":"https://github.com/so1ve/lite-emit","commit_stats":{"total_commits":273,"total_committers":4,"mean_commits":68.25,"dds":"0.18315018315018317","last_synced_commit":"15fd55891ddaed15397d30919f08ed7251738c47"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/so1ve%2Flite-emit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/so1ve%2Flite-emit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/so1ve%2Flite-emit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/so1ve%2Flite-emit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/so1ve","download_url":"https://codeload.github.com/so1ve/lite-emit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244426308,"owners_count":20450943,"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":["emit","emits","emits-events","emitter","events","nodejs","pubsub"],"created_at":"2024-10-10T12:18:55.254Z","updated_at":"2025-03-19T12:30:26.226Z","avatar_url":"https://github.com/so1ve.png","language":"TypeScript","funding_links":["https://afdian.net/@so1ve"],"categories":[],"sub_categories":[],"readme":"# lite-emit\n\n[![NPM version](https://img.shields.io/npm/v/lite-emit?color=a1b858\u0026label=)](https://www.npmjs.com/package/lite-emit)\n\nA simple, lightweight, and fast event emitter.\n\n## Usage\n\n```ts\nimport { LiteEmit } from \"lite-emit\";\n\ninterface Events {\n\tfoo: [string];\n\tbar: [\"bar\", number, symbol];\n\tbaz: [42];\n}\n\nconst emitter = new LiteEmit\u003cEvents\u003e();\n\nfunction fooListener1(str: string) {\n\tconsole.log(str);\n}\n\nfunction fooListener2(str: string) {\n\tconsole.log(str);\n}\n\nfunction fooListener3(str: string) {\n\tconsole.log(str);\n}\n\n// Add listeners\n// Chainable\nemitter.on(\"foo\", fooListener1);\nemitter.on(\"foo\", fooListener2);\nemitter.on(\"foo\", fooListener3).emit(\"foo\", \"hello\");\nemitter\n\t.on(\"baz\", (num) =\u003e {\n\t\tconsole.log(num);\n\t})\n\t.emit(\"baz\", \"42\");\n// 42\n\n// Remove a specified listener for a specified event\nemitter.off(\"foo\", fooListener1).emit(\"foo\", \"hello\");\n// Output:\n// hello\n// hello\n\n// Remove all listeners for a specified event\nemitter.off(\"foo\");\n// Output:\n// \u003cNONE\u003e\n\nemitter.emit(\"baz\", 42);\n// Output:\n// 42\n\n// Remove all wildcard listeners\nemitter.off(\"*\");\n\n// Remove all listeners for all events\nemitter.off();\n```\n\n## License\n\n[MIT](./LICENSE) License © 2022 [Ray](https://github.com/so1ve)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fso1ve%2Flite-emit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fso1ve%2Flite-emit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fso1ve%2Flite-emit/lists"}