Beagle v1.6 is no longer actively maintained. The documented version you are viewing may contain deprecated functionality. For up-to-date documentation, see the latest version .
To create a custom action in Beagle where execution is asynchronous such as consuming an API or accessing a database, just create an action
as usual as the previous example detailed and implement the AsyncAction
interface.
With the action created, just link the AsyncAction
interface and delegate its implementation to the AsyncActionImpl
class that Beagle already provides.
onActionStarted
and onActionFinished
, exposing its state in a reactive and standardized way in the framework.@RegisterAction
data class CustomActionAndroid(
val value: String
) : Action, AsyncAction by AsyncActionImpl() {
override fun execute(rootView: RootView) {
// Do asynchronous work
}
}
Now, with the action ready to execute asynchronously, you have to MANDATORY notify when its execution is finished through the onActionFinished
method.
@RegisterAction
data class CustomActionAndroid(
val value: String
) : Action, AsyncAction by AsyncActionImpl() {
override fun execute(rootView: RootView) {
// Do asynchronous work
onActionFinished()
}
}
It’s done! Your action is now configured to run any job asynchronously!
AsyncAction
interface for any custom action that is inserted within the ListView component.Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.