{"id":13564068,"url":"https://github.com/fffixed/vue-bus","last_synced_at":"2025-04-03T21:30:22.568Z","repository":{"id":215164842,"uuid":"98716531","full_name":"fffixed/vue-bus","owner":"fffixed","description":"Tiny simple central event bus plugin for Vue.js","archived":false,"fork":false,"pushed_at":"2018-01-29T08:44:21.000Z","size":10,"stargazers_count":50,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-04T17:45:49.758Z","etag":null,"topics":["events","vue-plugin","vuejs"],"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/fffixed.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}},"created_at":"2017-07-29T07:31:33.000Z","updated_at":"2022-08-08T15:44:22.000Z","dependencies_parsed_at":"2024-01-08T08:46:55.725Z","dependency_job_id":null,"html_url":"https://github.com/fffixed/vue-bus","commit_stats":null,"previous_names":["fffixed/vue-bus"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fffixed%2Fvue-bus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fffixed%2Fvue-bus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fffixed%2Fvue-bus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fffixed%2Fvue-bus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fffixed","download_url":"https://codeload.github.com/fffixed/vue-bus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247082744,"owners_count":20880709,"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":["events","vue-plugin","vuejs"],"created_at":"2024-08-01T13:01:26.238Z","updated_at":"2025-04-03T21:30:22.339Z","avatar_url":"https://github.com/fffixed.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","公用事业","Components \u0026 Libraries","Utilities","Utilities [🔝](#readme)"],"sub_categories":["自定义事件","Utilities","Custom Events"],"readme":"# vue-bus\n[![awesome-vue](https://img.shields.io/badge/Vue.js-AWESOME-ff69b4.svg)](//github.com/vuejs/awesome-vue)\n[![license](https://img.shields.io/github/license/fffixed/vue-bus.svg)](//opensource.org/licenses/MIT)\n\nA tiny simple central event bus plugin for [Vue.js](//vuejs.org) (requires Vue \u003e= 2.0).\n\nThe plugin realise [Non Parent-Child Communication](//vuejs.org/v2/guide/components.html#Non-Parent-Child-Communication).\n\n_(655 byte gzip)_\n\n## Installation\nDownload and use with your build system\n```javascript\nimport VueBus from 'vue-bus'\n// ... maybe ...\nvar VueBus = require('vue-bus')\n\n// ...  and  ...\n\nVue.use(VueBus)\n```\nOr just include it with a script tag\n```html\n\u003cscript src=\"/vue-bus.js\"\u003e\u003c/script\u003e\n```\n:sparkles:\n\n## Usage\ndirect way:\n```javascript\n// in component A's method\nthis.$bus.$emit('my-event', 1)\n\n// in component B's created hook\nthis.$bus.$on('my-event', function(arg) {\n  // ...\n})\n\n//And don't forget to use \"this.$bus.$off\" to remove unnecessary listeners.\n```\n\nmagic way:\n```javascript\n// in component A's method\nthis.$bus=['my-event', 1]\n\n// in component B create $bus option\nmethods: { /* ... */ },\n$bus: {\n  'my-event': function(arg) {\n    // ...\n  }\n}\n```\n\n## License\n[MIT](//opensource.org/licenses/MIT)\n\nCopyright (c) 2017 fffixed\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffffixed%2Fvue-bus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffffixed%2Fvue-bus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffffixed%2Fvue-bus/lists"}