Skip to content

Instantly share code, notes, and snippets.

View sacowiw's full-sized avatar
:octocat:
Focusing

Sacowiw sacowiw

:octocat:
Focusing
View GitHub Profile
@sacowiw
sacowiw / Event.kt
Created December 23, 2021 03:57 — forked from JoseAlcerreca/Event.kt
An event wrapper for data that is exposed via a LiveData that represents an event.
/**
* Used as a wrapper for data that is exposed via a LiveData that represents an event.
*/
open class Event<out T>(private val content: T) {
var hasBeenHandled = false
private set // Allow external read but not write
/**
* Returns the content and prevents its use again.