{"id":50418680,"url":"https://github.com/nnecec/mittss","last_synced_at":"2026-05-31T07:04:00.942Z","repository":{"id":271832675,"uuid":"913966067","full_name":"nnecec/mittss","owner":"nnecec","description":"Lightweight, extendable event emitter / pubsub.","archived":false,"fork":false,"pushed_at":"2025-08-19T01:56:56.000Z","size":266,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-30T16:58:45.246Z","etag":null,"topics":["emitter","event","event-bus","event-handlers","event-listener","eventbus","eventemitter","mitt","pubsub"],"latest_commit_sha":null,"homepage":"https://nnecec.github.io/mittss/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nnecec.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-01-08T17:32:46.000Z","updated_at":"2025-10-13T18:41:30.000Z","dependencies_parsed_at":"2025-05-09T04:21:36.097Z","dependency_job_id":"e064e2bb-0a7b-4b99-a208-a81496a7b81c","html_url":"https://github.com/nnecec/mittss","commit_stats":null,"previous_names":["nnecec/mittss"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/nnecec/mittss","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnecec%2Fmittss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnecec%2Fmittss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnecec%2Fmittss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnecec%2Fmittss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nnecec","download_url":"https://codeload.github.com/nnecec/mittss/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nnecec%2Fmittss/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33722162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"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":["emitter","event","event-bus","event-handlers","event-listener","eventbus","eventemitter","mitt","pubsub"],"created_at":"2026-05-31T07:04:00.870Z","updated_at":"2026-05-31T07:04:00.928Z","avatar_url":"https://github.com/nnecec.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mittss\n\n\u003e forked from [mitt](https://github.com/developit/mitt)\n\n![MIT](https://img.shields.io/npm/l/mittss)\n![NPM Version](https://img.shields.io/npm/v/mittss)\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/nnecec/mittss/ci.yml)\n[![codecov](https://codecov.io/github/nnecec/mittss/branch/main/graph/badge.svg?token=ojgghJz3ZZ)](https://codecov.io/github/nnecec/mittss)\n![npm package minimized gzipped size](https://img.shields.io/bundlejs/size/mittss)\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/nnecec/mittss)\n\n## What is Mittss?\n\n`mitt + class = mittss`\n\n`Mittss` is an lightweight and simple event emitter / pubsub, rewrite the `mitt`\nusing a class.\n\n- **Lightweight**: weighs less than 300 bytes gzipped\n- **Useful**: a wildcard `\"*\"` event type listens to all events\n- **Familiar**: same names \u0026 ideas as\n  [Node's EventEmitter](https://nodejs.org/docs/latest/api/events.html#class-eventemitter)\n- **Extendable**: easily extendable with inheritance.\n- **Zero Dependencies**: Works out of the box without additional libraries.\n\n## Differences from mitt\n\n`Emitter` is forked from [mitt](https://github.com/developit/mitt), with the\nfollowing key differences:\n\n- Implemented using `class`, supporting inheritance and extension.\n- Provides a `once` method for one-time event listeners.\n\n## Installation\n\n```bash\nnpm install mittss\n```\n\nor\n\n```bash\npnpm add mittss\n```\n\n## Usage\n\nVisit the [documentation website](https://nnecec.github.io/mittss/) to explore\nmore guides and API references.\n\n### Basic usage\n\n```javascript\nimport { Emitter } from 'mittss'\n\n// Create a Emitter instance\nconst emitter = new Emitter()\n\n// listen to an event\nemitter.on('foo', e =\u003e console.log('foo', e))\n\n// listen to all events\nemitter.on('*', (type, e) =\u003e console.log(type, e))\n\n// fire an event\nemitter.emit('foo', { a: 'b' })\n\n// clearing all events\nemitter.all.clear()\n\n// working with handler references:\nfunction onFoo() {}\nemitter.on('foo', onFoo) // listen\nemitter.off('foo', onFoo) // unlisten\nemitter.once('foo', onFoo) // listen once\n```\n\n### Typescript\n\nSet \"strict\": true in your tsconfig.json to get improved type inference for mitt\ninstance methods.\n\n```typescript\nimport { Emitter } from 'mittss'\n\ntype Events = {\n  foo: string\n  bar?: number\n}\n\nconst emitter = new Emitter\u003cEvents\u003e() // inferred as Emitter\u003cEvents\u003e\n\nemitter.on('foo', e =\u003e {}) // 'e' has inferred type 'string'\n\nemitter.emit('foo', 42) // Error: Argument of type 'number' is not assignable to parameter of type 'string'. (2345)\n```\n\n### Extending Emitter\n\nSince `Emitter` is a class, you can easily extend it to add custom\nfunctionality:\n\n```javascript\nclass MyEmitter extends Emitter {\n  constructor() {\n    super()\n  }\n\n  greet(name) {\n    this.emit('greet', name)\n  }\n}\n\nconst myEmitter = new MyEmitter()\nmyEmitter.on('greet', name =\u003e {\n  console.log(`Hello, ${name}!`)\n})\n\nmyEmitter.greet('Bob') // Output: Hello, Bob!\n```\n\n### Functional Emitter\n\n```typescript\nconst mitt = \u003cEvents extends Record\u003cEventType, unknown\u003e\u003e(\n  all?: EventHandlerMap\u003cEvents\u003e,\n) =\u003e {\n  return new Emitter\u003cEvents\u003e(all)\n}\n\nconst emitter = mitt()\n```\n\n## Acknowledgments\n\nThanks to [mitt](https://github.com/developit/mitt) again for the inspiration.\n\n## License\n\nMIT © [nnecec](https://github.com/nnecec)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnnecec%2Fmittss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnnecec%2Fmittss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnnecec%2Fmittss/lists"}