Skip to content

Commit

Permalink
fix subscribe extension to return subscription (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
Judrummer authored and beyondeye committed Sep 26, 2016
1 parent 539da74 commit 6695be0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions reduks/src/main/kotlin/com/beyondeye/reduks/Store.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@ interface Store<S> {
/**
* extension method for directly provide a lambda as argument for store subscribe
*/
fun <S>Store<S>.subscribe(lambda:()->Unit) {
this.subscribe(StoreSubscriber<S>{lambda()})
}
fun <S> Store<S>.subscribe(lambda: () -> Unit) = this.subscribe(StoreSubscriber<S> { lambda() })

/**
* extension method for checking at compile time that we only dispatch objects derived from
* base [Action] interface
*/
fun <S>Store<S>.dispatch_a(action:Action)=dispatch(action)
fun <S> Store<S>.dispatch_a(action: Action) = dispatch(action)

/**
* extension method for checking at compile time that we only dispatch objects derived from
* base [StandardAction] interface
*/
fun <S>Store<S>.dispatch_sa(action:StandardAction)=dispatch(action)
fun <S> Store<S>.dispatch_sa(action: StandardAction) = dispatch(action)

0 comments on commit 6695be0

Please sign in to comment.