[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-70690":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":32,"readmeContent":33,"aiSummary":34,"trendingCount":16,"starSnapshotCount":16,"syncStatus":18,"lastSyncTime":35,"discoverSource":36},70690,"mitt","developit\u002Fmitt","developit","🥊 Tiny 200 byte functional event emitter \u002F pubsub.","https:\u002F\u002Fnpm.im\u002Fmitt",null,"TypeScript",11871,483,66,16,0,1,2,3,43.05,"MIT License",false,"main",[25,26,27,28,29,5,30,31],"event","event-bus","event-handlers","event-listener","eventemitter","pubsub","tiny","2026-06-12 02:02:42","\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Fi.imgur.com\u002FBqsX9NT.png\" width=\"300\" height=\"300\" alt=\"mitt\">\n  \u003Cbr>\n  \u003Ca href=\"https:\u002F\u002Fwww.npmjs.org\u002Fpackage\u002Fmitt\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Fmitt.svg\" alt=\"npm\">\u003C\u002Fa>\n  \u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fdevelopit\u002Fmitt\u002Fworkflows\u002FCI\u002Fbadge.svg\" alt=\"build status\">\n  \u003Ca href=\"https:\u002F\u002Funpkg.com\u002Fmitt\u002Fdist\u002Fmitt.js\">\u003Cimg src=\"https:\u002F\u002Fimg.badgesize.io\u002Fhttps:\u002F\u002Funpkg.com\u002Fmitt\u002Fdist\u002Fmitt.js?compression=gzip\" alt=\"gzip size\">\u003C\u002Fa>\n\u003C\u002Fp>\n\n# Mitt\n\n> Tiny 200b functional event emitter \u002F pubsub.\n\n-   **Microscopic:** weighs less than 200 bytes gzipped\n-   **Useful:** a wildcard `\"*\"` event type listens to all events\n-   **Familiar:** same names & ideas as [Node's EventEmitter](https:\u002F\u002Fnodejs.org\u002Fapi\u002Fevents.html#events_class_eventemitter)\n-   **Functional:** methods don't rely on `this`\n-   **Great Name:** somehow [mitt](https:\u002F\u002Fnpm.im\u002Fmitt) wasn't taken\n\nMitt was made for the browser, but works in any JavaScript runtime. It has no dependencies and supports IE9+.\n\n## Table of Contents\n\n-   [Install](#install)\n-   [Usage](#usage)\n-   [Examples & Demos](#examples--demos)\n-   [API](#api)\n-   [Contribute](#contribute)\n-   [License](#license)\n\n## Install\n\nThis project uses [node](http:\u002F\u002Fnodejs.org) and [npm](https:\u002F\u002Fnpmjs.com). Go check them out if you don't have them locally installed.\n\n```sh\n$ npm install --save mitt\n```\n\nThen with a module bundler like [rollup](http:\u002F\u002Frollupjs.org\u002F) or [webpack](https:\u002F\u002Fwebpack.js.org\u002F), use as you would anything else:\n\n```javascript\n\u002F\u002F using ES6 modules\nimport mitt from 'mitt'\n\n\u002F\u002F using CommonJS modules\nvar mitt = require('mitt')\n```\n\nThe [UMD](https:\u002F\u002Fgithub.com\u002Fumdjs\u002Fumd) build is also available on [unpkg](https:\u002F\u002Funpkg.com):\n\n```html\n\u003Cscript src=\"https:\u002F\u002Funpkg.com\u002Fmitt\u002Fdist\u002Fmitt.umd.js\">\u003C\u002Fscript>\n```\n\nYou can find the library on `window.mitt`.\n\n## Usage\n\n```js\nimport mitt from 'mitt'\n\nconst emitter = mitt()\n\n\u002F\u002F listen to an event\nemitter.on('foo', e => console.log('foo', e) )\n\n\u002F\u002F listen to all events\nemitter.on('*', (type, e) => console.log(type, e) )\n\n\u002F\u002F fire an event\nemitter.emit('foo', { a: 'b' })\n\n\u002F\u002F clearing all events\nemitter.all.clear()\n\n\u002F\u002F working with handler references:\nfunction onFoo() {}\nemitter.on('foo', onFoo)   \u002F\u002F listen\nemitter.off('foo', onFoo)  \u002F\u002F unlisten\n```\n\n### Typescript\n\nSet `\"strict\": true` in your tsconfig.json to get improved type inference for `mitt` instance methods.\n\n```ts\nimport mitt from 'mitt';\n\ntype Events = {\n  foo: string;\n  bar?: number;\n};\n\nconst emitter = mitt\u003CEvents>(); \u002F\u002F inferred as Emitter\u003CEvents>\n\nemitter.on('foo', (e) => {}); \u002F\u002F 'e' has inferred type 'string'\n\nemitter.emit('foo', 42); \u002F\u002F Error: Argument of type 'number' is not assignable to parameter of type 'string'. (2345)\n```\n\nAlternatively, you can use the provided `Emitter` type:\n\n```ts\nimport mitt, { Emitter } from 'mitt';\n\ntype Events = {\n  foo: string;\n  bar?: number;\n};\n\nconst emitter: Emitter\u003CEvents> = mitt\u003CEvents>();\n```\n\n## Examples & Demos\n\n\u003Ca href=\"http:\u002F\u002Fcodepen.io\u002Fdevelopit\u002Fpen\u002FrjMEwW?editors=0110\">\n  \u003Cb>Preact + Mitt Codepen Demo\u003C\u002Fb>\n  \u003Cbr>\n  \u003Cimg src=\"https:\u002F\u002Fi.imgur.com\u002FCjBgOfJ.png\" width=\"278\" alt=\"preact + mitt preview\">\n\u003C\u002Fa>\n\n* * *\n\n## API\n\n\u003C!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n#### Table of Contents\n\n-   [mitt](#mitt)\n-   [all](#all)\n-   [on](#on)\n    -   [Parameters](#parameters)\n-   [off](#off)\n    -   [Parameters](#parameters-1)\n-   [emit](#emit)\n    -   [Parameters](#parameters-2)\n\n### mitt\n\nMitt: Tiny (~200b) functional event emitter \u002F pubsub.\n\nReturns **Mitt** \n\n### all\n\nA Map of event names to registered handler functions.\n\n### on\n\nRegister an event handler for the given type.\n\n#### Parameters\n\n-   `type` **([string](https:\u002F\u002Fdeveloper.mozilla.org\u002Fdocs\u002FWeb\u002FJavaScript\u002FReference\u002FGlobal_Objects\u002FString) \\| [symbol](https:\u002F\u002Fdeveloper.mozilla.org\u002Fdocs\u002FWeb\u002FJavaScript\u002FReference\u002FGlobal_Objects\u002FSymbol))** Type of event to listen for, or `'*'` for all events\n-   `handler` **[Function](https:\u002F\u002Fdeveloper.mozilla.org\u002Fdocs\u002FWeb\u002FJavaScript\u002FReference\u002FStatements\u002Ffunction)** Function to call in response to given event\n\n### off\n\nRemove an event handler for the given type.\nIf `handler` is omitted, all handlers of the given type are removed.\n\n#### Parameters\n\n-   `type` **([string](https:\u002F\u002Fdeveloper.mozilla.org\u002Fdocs\u002FWeb\u002FJavaScript\u002FReference\u002FGlobal_Objects\u002FString) \\| [symbol](https:\u002F\u002Fdeveloper.mozilla.org\u002Fdocs\u002FWeb\u002FJavaScript\u002FReference\u002FGlobal_Objects\u002FSymbol))** Type of event to unregister `handler` from, or `'*'`\n-   `handler` **[Function](https:\u002F\u002Fdeveloper.mozilla.org\u002Fdocs\u002FWeb\u002FJavaScript\u002FReference\u002FStatements\u002Ffunction)?** Handler function to remove\n\n### emit\n\nInvoke all handlers for the given type.\nIf present, `'*'` handlers are invoked after type-matched handlers.\n\nNote: Manually firing '\\*' handlers is not supported.\n\n#### Parameters\n\n-   `type` **([string](https:\u002F\u002Fdeveloper.mozilla.org\u002Fdocs\u002FWeb\u002FJavaScript\u002FReference\u002FGlobal_Objects\u002FString) \\| [symbol](https:\u002F\u002Fdeveloper.mozilla.org\u002Fdocs\u002FWeb\u002FJavaScript\u002FReference\u002FGlobal_Objects\u002FSymbol))** The event type to invoke\n-   `evt` **Any?** Any value (object is recommended and powerful), passed to each handler\n\n## Contribute\n\nFirst off, thanks for taking the time to contribute!\nNow, take a moment to be sure your contributions make sense to everyone else.\n\n### Reporting Issues\n\nFound a problem? Want a new feature? First of all see if your issue or idea has [already been reported](..\u002F..\u002Fissues).\nIf don't, just open a [new clear and descriptive issue](..\u002F..\u002Fissues\u002Fnew).\n\n### Submitting pull requests\n\nPull requests are the greatest contributions, so be sure they are focused in scope, and do avoid unrelated commits.\n\n-   Fork it!\n-   Clone your fork: `git clone https:\u002F\u002Fgithub.com\u002F\u003Cyour-username>\u002Fmitt`\n-   Navigate to the newly cloned directory: `cd mitt`\n-   Create a new branch for the new feature: `git checkout -b my-new-feature`\n-   Install the tools necessary for development: `npm install`\n-   Make your changes.\n-   Commit your changes: `git commit -am 'Add some feature'`\n-   Push to the branch: `git push origin my-new-feature`\n-   Submit a pull request with full remarks documenting your changes.\n\n## License\n\n[MIT License](https:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT) © [Jason Miller](https:\u002F\u002Fjasonformat.com\u002F)\n","Mitt 是一个轻量级的功能性事件发布\u002F订阅库。它仅重200字节（压缩后），支持通配符事件监听所有类型事件，并且与Node.js的EventEmitter有相似的命名和概念，但方法不依赖于`this`上下文，使得其更加灵活。Mitt非常适合在浏览器环境中使用，同时也兼容任何JavaScript运行时环境，对IE9及以上版本友好。由于体积小、无外部依赖，它特别适用于需要高效性能的小型应用或库中，如微前端架构下的组件间通信等场景。","2026-06-11 03:33:39","high_star"]