{"id":48680744,"url":"https://github.com/werbhelius/EventBusKotlin","last_synced_at":"2026-04-26T20:00:44.121Z","repository":{"id":96547599,"uuid":"101729333","full_name":"werbhelius/EventBusKotlin","owner":"werbhelius","description":"A Simple EventBus","archived":false,"fork":false,"pushed_at":"2017-10-25T02:21:54.000Z","size":230,"stargazers_count":44,"open_issues_count":0,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T21:47:16.690Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://t.me/android_with_kotlin","language":"Kotlin","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/werbhelius.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}},"created_at":"2017-08-29T06:53:36.000Z","updated_at":"2024-09-08T18:20:13.000Z","dependencies_parsed_at":"2023-04-15T14:18:41.118Z","dependency_job_id":null,"html_url":"https://github.com/werbhelius/EventBusKotlin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/werbhelius/EventBusKotlin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/werbhelius%2FEventBusKotlin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/werbhelius%2FEventBusKotlin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/werbhelius%2FEventBusKotlin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/werbhelius%2FEventBusKotlin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/werbhelius","download_url":"https://codeload.github.com/werbhelius/EventBusKotlin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/werbhelius%2FEventBusKotlin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32310804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T19:15:34.056Z","status":"ssl_error","status_checked_at":"2026-04-26T19:15:15.467Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-04-11T01:00:36.059Z","updated_at":"2026-04-26T20:00:44.115Z","avatar_url":"https://github.com/werbhelius.png","language":"Kotlin","funding_links":[],"categories":["进程间通信"],"sub_categories":["Spring Cloud框架"],"readme":"# EventBusKotlin\n\n用 Kotlin 简单实现了一个 EventBus\n\n[如何自己实现一个 EventBus](https://github.com/Werb/EventBusKotlin/wiki/%E5%A6%82%E4%BD%95%E8%87%AA%E5%B7%B1%E5%AE%9E%E7%8E%B0%E4%B8%80%E4%B8%AA-EventBus)\n\n[![Download](https://api.bintray.com/packages/werbhelius/maven/eventbuskotlin/images/download.svg) ](https://bintray.com/werbhelius/maven/eventbuskotlin/_latestVersion)\n\n## Dependency\n```gradle\ncompile 'com.werb.eventbuskotlin:eventbuskotlin:0.2.0'\n```\nor\n```gradle\nimplementation 'com.werb.eventbuskotlin:eventbuskotlin:0.2.0'\n```\n\n\n#### 注册和取消注册\n```kotlin\nEventBus.register(this)\nEventBus.unRegister(this)\n```\n#### 实现事件 Event 实体类（实现 IEvent 接口）\n```kotlin\nclass XXXXEvent: IEvent\n```\n#### 发送事件\n```kotlin\nEventBus.post(XXXEvent())\n```\n#### 利用注解实现事件订阅执行方法\n\n* tag 用于细化区分事件\n* mode 方法执行线程\n\n```kotlin\n@Subscriber(tag = DEFAULT_TAG, mode = ThreadMode.MAIN)\n    private fun change2(event: XXXEvent){\n        textView2.text = \"今天星期五\"\n        textView2.setTextColor(resources.getColor(R.color.colorAccent))\n\n        println(\"myActivity - 200\")\n    }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwerbhelius%2FEventBusKotlin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwerbhelius%2FEventBusKotlin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwerbhelius%2FEventBusKotlin/lists"}