Skip to content

Instantly share code, notes, and snippets.

@IslamKhSh
Created May 23, 2021 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IslamKhSh/e45fc480427f3da6ffb707fcc0ba28ba to your computer and use it in GitHub Desktop.
Save IslamKhSh/e45fc480427f3da6ffb707fcc0ba28ba to your computer and use it in GitHub Desktop.
class CustomSingleLiveEvent<T> : SingleLiveEvent<T>() {
override fun setValue(t: T?) {
if (this.hasActiveObservers())
super.setValue(t)
}
override fun postValue(value: T) {
if (this.hasActiveObservers())
super.postValue(value)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment