Skip to content

Instantly share code, notes, and snippets.

@SeongUgJung
Created August 6, 2019 16:18
Show Gist options
  • Save SeongUgJung/7b43158854d4d98a65a4442b7fcd00de to your computer and use it in GitHub Desktop.
Save SeongUgJung/7b43158854d4d98a65a4442b7fcd00de to your computer and use it in GitHub Desktop.
// 기존
RxLifecycle().apply { init = Observable.create().subscribe() }
// 코드 추가
fun onInit(disposableFunction: () -> disposable): RxLifecycle
class RxLifecycle : LifecycleObserver {
fun init(init: DisposableFunction): RxLifecycle {
this.onInit = init
return this
}
}
// 변경 후
onInit { Observable.create().subscribe() }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment