Skip to content

Commit

Permalink
feat: add start loading functions
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyMuse committed Dec 11, 2022
1 parent 947dbd4 commit e0a8b68
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,7 @@ fun <T> ApiResult<T>.asViewEvent() = when (this) {
ApiResult.Idle -> ViewStatefulEvent.Idle
ApiResult.Loading -> ViewStatefulEvent.Loading
is ApiResult.Success -> ViewStatefulEvent.Success
}
}

fun <T> ViewStateContract<T>.startLoading() = ApiResult.Loading.asViewStatePayload(this)
suspend fun <T> ViewStateContract<T>.startLoadingWithEvents() = ApiResult.Loading.asViewStatePayloadWithEvents(this)

0 comments on commit e0a8b68

Please sign in to comment.