Skip to content

Jutsu for teleport your event πŸ€˜πŸ€žπŸ€™πŸ––πŸ™

Notifications You must be signed in to change notification settings

utsmannn/hiraishin-no-jutsu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Hiraishin No Jutsu

Teleport your event like Hokage Jutsu !

  • Build with Rx and Kotlin
  • Lightweight, only one file, less than 100 lines
  • Easy to use

Download

// required rx android
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'

// download hiraishin no jutsu
implementation 'com.utsman.hiraishin:hirasihin:1.0.1'

Usage

String key

Post

// teleport string key for notify your event
HiraishinNoJutsu.getInstance().post("key")

Observer

HiraishinNoJutsu.getInstance().observer { key, composite ->
   // your event when key is arrived
   // composite.dispose() if you will stop observer
}

Intent

Post

// create intent with extras
val intent = Intent().apply {
    putExtra("event", "whatever")
}
// teleport your intent, like send broadcast
HiraishinNoJutsu.getInstance().postIntent("key", intent)

Observer

HiraishinNoJutsu.getInstance().observerIntent { key, intent, composite ->
   // intent is arrived with key
}

// or create function with intent
private fun subscriber(intent: Intent) {
    // your code with intent
}

// and install your function on composite disposable
compositeDisposable.hiraishinIntent("key", this::subscriber)

Copyright 2020 Muhammad Utsman

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Jutsu for teleport your event πŸ€˜πŸ€žπŸ€™πŸ––πŸ™

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages