mplatvoet
06/24/2016, 9:02 AMval uiContext = Kovenant.createContext {
workerContext {
dispatcher = androidUiDispatcher()
errorHandler = Kovenant.context.workerContext.errorHandler
}
callbackContext {
dispatcher = Kovenant.context.callbackContext.dispatcher
errorHandler = Kovenant.context.callbackContext.errorHandler
}
}
val promise = Promise.of(42).then(uiContext) {
//This will execute on ui thread
}
//Turn back into normal context if you want to pass it through your app
promise.withContext(Kovenant.context)