Skip to content

Instantly share code, notes, and snippets.

View faizul14's full-sized avatar
🚀
I may be slow to respond.

M Faezol Padli faizul14

🚀
I may be slow to respond.
View GitHub Profile
@faizul14
faizul14 / Event.kt
Created June 18, 2022 15:41 — 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.