{"id":21937650,"url":"https://github.com/cap32/emit-lite","last_synced_at":"2026-04-18T02:07:31.131Z","repository":{"id":88318516,"uuid":"71791118","full_name":"Cap32/emit-lite","owner":"Cap32","description":"Light weight event-emitter for Node.js and browser","archived":false,"fork":false,"pushed_at":"2017-01-31T16:16:48.000Z","size":43,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-22T14:26:15.517Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Cap32.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2016-10-24T13:20:01.000Z","updated_at":"2017-01-31T16:25:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"0e18488a-33fa-49c7-86fc-0379f1d76333","html_url":"https://github.com/Cap32/emit-lite","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Cap32/emit-lite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap32%2Femit-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap32%2Femit-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap32%2Femit-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap32%2Femit-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cap32","download_url":"https://codeload.github.com/Cap32/emit-lite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap32%2Femit-lite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31953517,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-29T01:21:09.697Z","updated_at":"2026-04-18T02:07:31.083Z","avatar_url":"https://github.com/Cap32.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Super Light weight Event Emitter for Node.js and browser.\n\n[![Build Status](https://travis-ci.org/Cap32/emit-lite.svg?branch=master)](https://travis-ci.org/Cap32/emit-lite)\n\n## Installing\n\nUsing npm:\n\n```bash\n$ npm install emit-lite\n```\n\nUsing yarn:\n\n```bash\n$ yarn add emit-lite\n```\n\n## Usage\n\nemitter.on(eventType, handler)\n\nemitter.emit(eventType, [arg[, ...]])\n\n```js\nimport EmitLite from 'emit-lite';\n\nconst emitter = new EmitLite();\n\nemitter.on('test:on', (a, b) =\u003e {\n\tconsole.log(a); // =\u003e 'a'\n\tconsole.log(b); // =\u003e 'b'\n});\nemitter.emit('test:on', 'a', 'b');\n```\n\nemitter.once(eventType, handler)\n\n```js\nemitter.once('test:once', () =\u003e {\n\tconsole.log('once'); // will only log once.\n});\nemitter.emit('test:once');\nemitter.emit('test:once');\n```\n\nemitter.off(eventType[, handler])\n\n```js\nconst handler = () =\u003e console.log('emitted'); // will never log anything\n\nemitter.on('test:off', handler);\nemitter.off('test:off');\nemitter.emit('test:off');\n```\n\n`emitter.off()` could also be done as\n\n```js\nconst handler = () =\u003e console.log('emitted'); // will never log anything\n\nconst off = emitter.on('test:off', handler);\noff();\nemitter.emit('test:off');\n```\n\nemitter.listenerCount(eventType)\n\n```js\nconst count = 3;\nnew Array(count).fill().forEach(() =\u003e emitter.on('test:listenerCount'));\nconsole.log(emitter.listenerCount('test:listenerCount')); // =\u003e 3;\n```\n\nEmitLite.mixin(targetObject)\n\n```js\nimport EmitLite from 'emit-lite';\n\nconst obj = { a: 'a' };\nEmitLite.mixin(obj);\nobj.on('test:mixin', (b) =\u003e {\n\tconsole.log(obj.a); // =\u003e 'a'\n\tconsole.log(b); // =\u003e 'b'\n});\nobj.emit('test:mixin', 'b');\n```\n\nES6 class extends\n\n```js\nimport EmitLite from 'emit-lite';\n\nclass Obj extends EmitLite {\n\tgetB() {\n\t\treturn 'b';\n\t}\n}\nconst obj = new Obj();\nobj.on('test:extends', function (a) {\n\tconsole.log(a); // =\u003e 'a'\n\tconsole.log(this.getB()); // =\u003e 'b'\n});\nobj.emit('test:extends', 'a');\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcap32%2Femit-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcap32%2Femit-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcap32%2Femit-lite/lists"}