Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
robertfmurdock committed Jul 13, 2023
1 parent 9f88d32 commit 85a92bf
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@ class DecoratedDispatchFunc<D : SuspendActionExecuteSyntax>(

override fun <C : SuspendAction<D, R>, R> invoke(commandFunc: () -> C, response: (R) -> Unit) = fun() {
val command = commandFunc()
dispatcher.asyncExecute(command, response)
}

private fun <C : SuspendAction<D, R>, R> D.asyncExecute(command: C, onResponse: (R) -> Unit) =
tools.performAsyncWork(
{ execute(command) },
{ command.execute(dispatcher) },
{ handler: Throwable -> throw handler },
onResponse,
response,
)
}
}

0 comments on commit 85a92bf

Please sign in to comment.