{"id":13482995,"url":"https://github.com/greenrobot/EventBus","last_synced_at":"2025-03-27T13:33:16.318Z","repository":{"id":3975236,"uuid":"5070389","full_name":"greenrobot/EventBus","owner":"greenrobot","description":"Event bus for Android and Java that simplifies communication between Activities, Fragments, Threads, Services, etc. Less code, better quality.","archived":false,"fork":false,"pushed_at":"2024-02-21T18:18:34.000Z","size":1742,"stargazers_count":24573,"open_issues_count":145,"forks_count":4653,"subscribers_count":1045,"default_branch":"master","last_synced_at":"2024-04-05T03:09:04.477Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://greenrobot.org/eventbus/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"pugjs/pug-cli","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/greenrobot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2012-07-16T16:55:40.000Z","updated_at":"2024-04-24T22:42:01.166Z","dependencies_parsed_at":"2023-01-13T12:51:53.481Z","dependency_job_id":"e4c05a3f-f8e1-47f0-9891-94d810097ab0","html_url":"https://github.com/greenrobot/EventBus","commit_stats":{"total_commits":510,"total_committers":31,"mean_commits":"16.451612903225808","dds":"0.30000000000000004","last_synced_commit":"0194926b3bcf70cc0d7bfd3c5da16708dd5ab876"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenrobot%2FEventBus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenrobot%2FEventBus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenrobot%2FEventBus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenrobot%2FEventBus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/greenrobot","download_url":"https://codeload.github.com/greenrobot/EventBus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221887107,"owners_count":16898196,"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":[],"created_at":"2024-07-31T17:01:07.330Z","updated_at":"2024-10-30T16:31:58.663Z","avatar_url":"https://github.com/greenrobot.png","language":"Java","readme":"EventBus\n========\n[EventBus](https://greenrobot.org/eventbus/) is a publish/subscribe event bus for Android and Java.\u003cbr/\u003e\n\u003cimg src=\"EventBus-Publish-Subscribe.png\" width=\"500\" height=\"187\"/\u003e\n\n[![Build Status](https://github.com/greenrobot/EventBus/actions/workflows/gradle.yml/badge.svg)](https://github.com/greenrobot/EventBus/actions)\n[![Follow greenrobot on Twitter](https://img.shields.io/twitter/follow/greenrobot_de.svg?style=flat-square\u0026logo=twitter)](https://twitter.com/greenrobot_de)\n\nEventBus...\n\n * simplifies the communication between components\n    * decouples event senders and receivers\n    * performs well with Activities, Fragments, and background threads\n    * avoids complex and error-prone dependencies and life cycle issues\n * makes your code simpler\n * is fast\n * is tiny (~60k jar)\n * is proven in practice by apps with 1,000,000,000+ installs\n * has advanced features like delivery threads, subscriber priorities, etc.\n\nEventBus in 3 steps\n-------------------\n1. Define events:\n\n    ```java  \n    public static class MessageEvent { /* Additional fields if needed */ }\n    ```\n\n2. Prepare subscribers:\n    Declare and annotate your subscribing method, optionally specify a [thread mode](https://greenrobot.org/eventbus/documentation/delivery-threads-threadmode/):  \n\n    ```java\n    @Subscribe(threadMode = ThreadMode.MAIN)  \n    public void onMessageEvent(MessageEvent event) {\n        // Do something\n    }\n    ```\n    Register and unregister your subscriber. For example on Android, activities and fragments should usually register according to their life cycle:\n\n   ```java\n    @Override\n    public void onStart() {\n        super.onStart();\n        EventBus.getDefault().register(this);\n    }\n \n    @Override\n    public void onStop() {\n        super.onStop();\n        EventBus.getDefault().unregister(this);\n    }\n    ```\n\n3. Post events:\n\n   ```java\n    EventBus.getDefault().post(new MessageEvent());\n    ```\n\nRead the full [getting started guide](https://greenrobot.org/eventbus/documentation/how-to-get-started/).\n\nThere are also some [examples](https://github.com/greenrobot-team/greenrobot-examples).\n\n**Note:** we highly recommend the [EventBus annotation processor with its subscriber index](https://greenrobot.org/eventbus/documentation/subscriber-index/).\nThis will avoid some reflection related problems seen in the wild.  \n\nAdd EventBus to your project\n----------------------------\n\u003ca href=\"https://search.maven.org/search?q=g:org.greenrobot%20AND%20a:eventbus\"\u003e\u003cimg src=\"https://img.shields.io/maven-central/v/org.greenrobot/eventbus.svg\"\u003e\u003c/a\u003e\n\nAvailable on \u003ca href=\"https://search.maven.org/search?q=g:org.greenrobot%20AND%20a:eventbus\"\u003eMaven Central\u003c/a\u003e.\n\nAndroid projects:\n```groovy\nimplementation(\"org.greenrobot:eventbus:3.3.1\")\n```\n\nJava projects:\n```groovy\nimplementation(\"org.greenrobot:eventbus-java:3.3.1\")\n```\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.greenrobot\u003c/groupId\u003e\n    \u003cartifactId\u003eeventbus-java\u003c/artifactId\u003e\n    \u003cversion\u003e3.3.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nR8, ProGuard\n------------\n\nIf your project uses R8 or ProGuard this library ships [with embedded rules](/eventbus-android/consumer-rules.pro).\n\nHomepage, Documentation, Links\n------------------------------\nFor more details please check the [EventBus website](https://greenrobot.org/eventbus). Here are some direct links you may find useful:\n\n[Features](https://greenrobot.org/eventbus/features/)\n\n[Documentation](https://greenrobot.org/eventbus/documentation/)\n\n[Changelog](https://github.com/greenrobot/EventBus/releases)\n\n[FAQ](https://greenrobot.org/eventbus/documentation/faq/)\n\nLicense\n-------\nCopyright (C) 2012-2021 Markus Junginger, greenrobot (https://greenrobot.org)\n\nEventBus binaries and source code can be used according to the [Apache License, Version 2.0](LICENSE).\n\nOther projects by greenrobot\n============================\n[__ObjectBox__](https://objectbox.io/) ([GitHub](https://github.com/objectbox/objectbox-java)) is a new superfast object-oriented database.\n\n[__Essentials__](https://github.com/greenrobot/essentials) is a set of utility classes and hash functions for Android \u0026 Java projects.\n","funding_links":[],"categories":[":shamrock:  **Categories**","Java","Index","Projects","Solutions","Libraries","Libs","Android应用","项目","第二部分 工具库","Uncategorized","Pub/Sub","1. Important library","进程间通信"],"sub_categories":[":books: Libraries","Event Buses","Messaging","EventBus","\u003cA NAME=\"EventBus\"\u003e\u003c/A\u003eEventBus","资源传输下载","消息传递","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreenrobot%2FEventBus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreenrobot%2FEventBus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreenrobot%2FEventBus/lists"}