{"id":20105937,"url":"https://github.com/markthree/tob-mitt","last_synced_at":"2025-03-02T17:47:02.921Z","repository":{"id":57377535,"uuid":"451507541","full_name":"markthree/tob-mitt","owner":"markthree","description":"mitt 的 uni_modules 完美迁移版本","archived":false,"fork":false,"pushed_at":"2024-02-28T08:49:50.000Z","size":4,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-29T21:11:28.159Z","etag":null,"topics":["mitt","tob","uniapp","vue3"],"latest_commit_sha":null,"homepage":"","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/markthree.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":"2022-01-24T14:55:29.000Z","updated_at":"2022-01-24T14:57:57.000Z","dependencies_parsed_at":"2024-11-13T17:58:52.394Z","dependency_job_id":null,"html_url":"https://github.com/markthree/tob-mitt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markthree%2Ftob-mitt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markthree%2Ftob-mitt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markthree%2Ftob-mitt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markthree%2Ftob-mitt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markthree","download_url":"https://codeload.github.com/markthree/tob-mitt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241549089,"owners_count":19980475,"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":["mitt","tob","uniapp","vue3"],"created_at":"2024-11-13T17:48:40.194Z","updated_at":"2025-03-02T17:47:02.899Z","avatar_url":"https://github.com/markthree.png","language":"JavaScript","readme":"# tob-mitt\n\n在 `vue3` 中，[mitt](https://github.com/developit/mitt) 是一个推荐的 `eventBus` 库。这是一个 `uni_modules` 的完美迁移版本。\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n## 原仓库 📦\n👉 [mitt](https://github.com/developit/mitt)\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n## Usage 🦖\n```js\nimport mitt from \"@/uni_modules/tob-mitt/index.js\"\n\nconst bus = mitt()\n\n// 注册两个指定类型的事件函数\nbus.on('foo', () =\u003e console.log('我是foo1'))\nbus.on('foo', () =\u003e console.log('我是foo2'))\n\n// 触发该类型的事件函数\nbus.emit('foo') // 将打印 我是foo1，我是foo2\n\n// 注册一个带形参的事件函数\nbus.on('bar', (msg) =\u003e console.log(msg))\n\n// 触发事件函数的同时设置实参\nbus.emit('bar', '你好') // 将打印 你好\n\nbus.off('bar') // 卸载所有 bar 事件函数\n\nconst bar = () =\u003e console.log('我好')\nbus.on('bar', bar)\nbus.off('bar', bar) // 单独卸载该事件函数\n\nbus.emit('bar') // 因为被卸载了，所以什么都不会触发\n\n// 注册所有类型的事件函数\nbus.on('*', () =\u003e {\n    console.log(\"不论什么时候都会触发\")\n})\n\n// 触发 * 类型的事件函数\nbus.emit() // 打印 不论什么时候都会触发\n\nbus.emit('foo') // 打印 我是foo1，我是foo2 不论什么时候都会触发\n\nbus.all // 保存事件函数的 map\n```\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n\n## 组织 🦔\n\n欢迎关注 **帝莎编程**\n- [官网](http://dishaxy.dishait.cn/)\n- [Gitee](https://gitee.com/dishait)\n\n- [Github](https://github.com/dishait)\n\n- [网易云课堂](https://study.163.com/provider/480000001892585/index.htm?share=2\u0026shareId=480000001892585)\n\n\u003cbr /\u003e\n\u003cbr /\u003e\n\n## License\n\nMade with markthree\n\nPublished under [MIT License](./LICENSE).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkthree%2Ftob-mitt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkthree%2Ftob-mitt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkthree%2Ftob-mitt/lists"}