{"id":20473673,"url":"https://github.com/joshuadeguzman/rxbus","last_synced_at":"2025-04-13T11:30:23.846Z","repository":{"id":127063868,"uuid":"141125824","full_name":"joshuadeguzman/RxBus","owner":"joshuadeguzman","description":"A simplified event-driven library on top of Kotlin and Rx","archived":false,"fork":false,"pushed_at":"2018-10-08T10:00:50.000Z","size":159,"stargazers_count":3,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T08:07:50.511Z","etag":null,"topics":["eventbus","higher-order-function","kfunctions","kotlin","rx","rxjava"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/joshuadeguzman.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-16T10:49:59.000Z","updated_at":"2019-06-27T06:25:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"80e5fd98-f1c5-4595-aa34-b4ab17f144c6","html_url":"https://github.com/joshuadeguzman/RxBus","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshuadeguzman%2FRxBus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshuadeguzman%2FRxBus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshuadeguzman%2FRxBus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshuadeguzman%2FRxBus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshuadeguzman","download_url":"https://codeload.github.com/joshuadeguzman/RxBus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248705469,"owners_count":21148544,"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":["eventbus","higher-order-function","kfunctions","kotlin","rx","rxjava"],"created_at":"2024-11-15T14:26:14.961Z","updated_at":"2025-04-13T11:30:23.840Z","avatar_url":"https://github.com/joshuadeguzman.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RxBus\nA simplified event-driven library on top of Kotlin and Rx\n\n[![Kotlin](https://img.shields.io/badge/Kotlin-1.2.51-green.svg?style=flat-square)](http://kotlinlang.org)\n[![RxJava](https://img.shields.io/badge/Support-27.1.1-6ab344.svg?style=flat-square)](https://github.com/ReactiveX/RxJava/releases/tag/v2.1.10)\n[![Build Status](https://img.shields.io/travis/joshuadeguzman/RxBus.svg?style=flat-square)](https://travis-ci.org/joshuadeguzman/RxBus)\n[![GitHub (pre-)release](https://img.shields.io/github/release/joshuadeguzman/rxbus/all.svg?style=flat-square)\n](./../../releases)\n\n### Features\n\n| Methods                           | Usage                                                   |\n| -                                 | -                                                       |\n| subscribe`\u003cEvent\u003e`(subscriber)      | Register type object as an observer                     |\n| post(event: Any)                  | Passing event class to be ommitted on the observer      |\n| unsubscribe(subscriber: Any)      | Removes registered observers from the disposables       |\n\n### Installation\n```gradle\nrepositories {\n    maven { url \"https://jitpack.io\" }\n}\n\ndependencies {\n    // Replace version with release version, e.g. 1.0.0-alpha, -SNAPSHOT\n    implementation 'io.jmdg:rxbus:[VERSION]'\n}\n```\n\n### Create Events\n```kotlin\n// Events.kt\n// Define your events here\n\n// Passing data\ndata class ShowDataEvent(val data: String)\n\n// No passing of data\nclass NoDataEvent\n```\n\n### Implement methods\n```kotlin\n// Activity.kt\n// This defines subscriptions (eg. on onCreate)\n\noverride fun onCreate(savedInstanceState: Bundle?) {\n    super.onCreate(savedInstanceState)\n    setContentView(R.layout.main_activity)\n    \n    // Register observers\n    RxBus.subscribe\u003cShowDataEvent\u003e(this) {\n        Log.e(tag, it.data)\n    }\n\n    RxBus.subscribe\u003cNoDataEvent\u003e(this) {\n        callSomeMethod()\n    }\n}\n\n// Remove subscriptions\noverride fun onStop() {\n    super.onStop()\n    RxBus.unsubscribe(this)\n}\n\noverride fun onDestroy() {\n    super.onDestroy()\n    RxBus.unsubscribe(this)\n}\n```\n\n```kotlin\n// Fragment.kt\n// This sends data to event observers/subscribers\n\noverride fun onCreate(savedInstanceState: Bundle?) {\n    super.onCreate(savedInstanceState)\n    setContentView(R.layout.main_fragment)\n    \n    bt_send_data.setOnClickListener {\n        RxBus.post(ShowDataEvent(\"Hi, this is from Fragment.kt\"))\n    }\n}\n```\n\n### License\n\nRxBus is released under the MIT License. See [LICENSE](https://github.com/joshuadeguzman/RxBus/blob/master/LICENSE) for details.\n\n### Contributing\n\n1. Fork it (\u003chttps://github.com/joshuadeguzman/RxBus/fork\u003e)\n2. Create your feature branch (`git checkout -b feature/fooBar`)\n3. Commit your changes (`git commit -am 'Add some fooBar'`)\n4. Push to the branch (`git push origin feature/fooBar`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshuadeguzman%2Frxbus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshuadeguzman%2Frxbus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshuadeguzman%2Frxbus/lists"}