{"id":13537723,"url":"https://github.com/sergejsha/tinybus","last_synced_at":"2025-12-16T22:37:57.202Z","repository":{"id":20505179,"uuid":"23783730","full_name":"sergejsha/tinybus","owner":"sergejsha","description":"Simple, lightweight and fast event bus tailored for Android","archived":true,"fork":false,"pushed_at":"2019-05-22T12:36:31.000Z","size":2309,"stargazers_count":599,"open_issues_count":4,"forks_count":52,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-04-11T17:20:01.066Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sergejsha.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}},"created_at":"2014-09-08T08:21:47.000Z","updated_at":"2024-03-31T14:15:11.000Z","dependencies_parsed_at":"2022-09-09T12:01:06.228Z","dependency_job_id":null,"html_url":"https://github.com/sergejsha/tinybus","commit_stats":null,"previous_names":["beworker/tinybus"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergejsha%2Ftinybus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergejsha%2Ftinybus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergejsha%2Ftinybus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergejsha%2Ftinybus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sergejsha","download_url":"https://codeload.github.com/sergejsha/tinybus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246757245,"owners_count":20828863,"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-08-01T09:01:02.797Z","updated_at":"2025-12-16T22:37:52.164Z","avatar_url":"https://github.com/sergejsha.png","language":"Java","funding_links":[],"categories":["Java","进程间通信"],"sub_categories":["Spring Cloud框架"],"readme":"This project is **@deprecated** in favor of [RxJava](https://github.com/ReactiveX/RxJava). It offers the same event-driven programming model as TinyBus, but it's more capable and offers better control of threading.\n\n---\n\n![tinybus][1]\n\nTinyBus is the faster implementation of [Otto][2] event bus with additional features you missed.\n\n[![Build Status](https://travis-ci.org/beworker/tinybus.svg?branch=master)](https://travis-ci.org/beworker/tinybus)\n\nTinyBus is\n=======\n - tiny (~ 26K jar)\n - fast (optimized for startup and event dispatching)\n - well tested (\u003e 90 junit tests)\n - annotation based (no requirements on method names, no interfaces to implement)\n\nTinyBus API in a nutshell\n=======\n - `@Subscribe` annotates event handler methods running in the main thread.\n - `@Subscribe(mode=Mode.Background)` annotates event handler methods running in a background thread.\n - `@Subscribe(mode=Mode.Background, queue=\"web\")` annotates event handler methods running in a serialized background queue with given name. You can have as many queues as you want.\n - `@Produce` annotates methods returning most recent events (aka sticky events).\n - `Bus.register(Object)` and `Bus.unregister(Object)` register and unregister objects with annotated subscriber and producer methods.\n - `Bus.hasRegistered(Object)` checks, whether given object is already registered.\n - `Bus.post(Object)` posts given event object to all registered subscribers.\n - `Bus.postDelayed(Object, long)` and `Bus.cancelDelayed(Class)` schedules single event delivery for later in time and cancels it.\n\nFor a more detailed example check out [Getting started][4] step-by-step guide or example application.\n\nPerformance reference tests\n=======\n![tinybus][3]\n\nExecuted on Nexus 5 device (Android 5.0.1, ART, screen off).\n\nTinyBus extensions (still in 'β')\n=======\n\nExtensions is a unique feature of TinyBus. With it you can easily subscribe to commonly used events like battery level, connectivity change, phone shake event or even standard Android broadcast Intents. Here is a short example.\n\n```java\npublic class MainActivity extends Activity {\n    private TinyBus mBus;\n        \n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n        \n        // get bus instance \n        mBus = TinyBus.from(this)\n        \n        if (savedInstanceState == null) {\n            // Note: ShakeEventWire stays wired when activity is re-created\n            //       on configuration change. That's why we register is \n            //       only once inside if-statement.\n\n            // wire device shake event provider\n            mBus.wire(new ShakeEventWire());\n        }\n    }\n    \n    @Override\n    protected void onStart() {\n        super.onStart();\n\t    mBus.register(this);\n\t}\n\t\n    @Override\n    protected void onStop() {\n        mBus.unregister(this);\n        super.onStop();\n    }\n    \n    @Subscribe\n    public void onShakeEvent(ShakeEvent event) {\n        // device has been shaken\n    }\n}\n```\nMore detailed usage example can be found in example application.\n\nGradle dependencies\n=======\n\nFor pure event bus implementation\n```\ndependencies {\n    compile 'de.halfbit:tinybus:3.0.2'\n}\n```\nFor event bus with extensions\n```\ndependencies {\n    compile 'de.halfbit:tinybus:3.0.2'\n    compile 'de.halfbit:tinybus-extensions:3.0.2'\n}\n```\n\nProGuard configuration\n=======\n\nIf you use Gradle build, then you don't need to configure anything, because it will use proper configuration already delivered with Android library archive. Otherwise you can use the configuration below:\n```\n-keepclassmembers, allowobfuscation class ** {\n    @de.halfbit.tinybus.Subscribe public *;\n    @de.halfbit.tinybus.Produce public *;\n}\n```\n\nUsed by\n=======\n\n - [franco.Kernel updater][6]\n - [Settings Extended][5]\n - [Focus][7]\n\nLicense\n=======\n\n    Copyright (c) 2014-2015 Sergej Shafarenka, halfbit.de\n    Copyright (C) 2012 Square, Inc.\n    Copyright (C) 2007 The Guava Authors\n    \n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n\n[1]: web/tinybus.png\n[2]: https://github.com/square/otto\n[3]: web/performance.png\n[4]: https://github.com/beworker/tinybus/wiki/Getting-Started\n[5]: https://play.google.com/store/apps/details?id=com.hb.settings\n[6]: https://play.google.com/store/apps/details?id=com.franco.kernel\n[7]: https://play.google.com/store/apps/details?id=com.franco.focus\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergejsha%2Ftinybus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsergejsha%2Ftinybus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergejsha%2Ftinybus/lists"}