Skip to content

Commit bd322d1

Browse files
author
Patrick Jackson
committed
add thunk.withArgument() ext fun
1 parent 4fde415 commit bd322d1

File tree

1 file changed

+4
-1
lines changed
  • lib/src/commonMain/kotlin/org/reduxkotlin

1 file changed

+4
-1
lines changed

lib/src/commonMain/kotlin/org/reduxkotlin/Thunk.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package org.reduxkotlin
22

33
typealias Thunk = (Dispatcher, GetState, Any?) -> Any
4-
fun createThunkMiddleware(extraArgument: Any? = null): Middleware =
4+
typealias ThunkMiddleware = Middleware
5+
fun createThunkMiddleware(extraArgument: Any? = null): ThunkMiddleware =
56
{ store ->
67
{ next: Dispatcher ->
78
{ action: Any ->
@@ -19,3 +20,5 @@ fun createThunkMiddleware(extraArgument: Any? = null): Middleware =
1920
}
2021

2122
val thunk = createThunkMiddleware()
23+
24+
fun ThunkMiddleware.withExtraArgument(arg: Any?) = createThunkMiddleware(arg)

0 commit comments

Comments
 (0)