SuspendingAction

abstract class SuspendingAction : Action(source)

An Action that suspends while performing its work instead of blocking its calling thread.

Subclasses implement performSuspending instead of Action.perform. The actions framework (ActionRunRequest, ActionRunner, the JavaScript bridge, push and Scene/IAA actions) awaits it internally, so the ActionResult reflects the completed work, capped in the Scene/IAA case by that layout's own timeout: a Thomas layout only waits up to 5 seconds (ACTION_RUN_TIMEOUT in BaseModel) before continuing teardown, after which the action keeps running untracked.

Blocking entry points (Action.run, ActionRunRequest.runSync) still work for compatibility, but block the calling thread until the action completes; don't call them from the main thread.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard

Blocking bridge to performSuspending, provided for legacy callers.

Link copied to clipboard
abstract suspend override fun performSuspending(arguments: ActionArguments): ActionResult

Performs the action, suspending until it completes.

Inherited functions

Link copied to clipboard

Called before an action is performed to determine if the the action can accept the arguments.

Link copied to clipboard
open fun onFinish(arguments: ActionArguments, result: ActionResult)

Called after the action performs.

Link copied to clipboard
open fun onStart(arguments: ActionArguments)

Called before an action is performed.

Link copied to clipboard

Performs the action, with pre/post execution calls, if it accepts the provided arguments.

Link copied to clipboard
suspend fun runSuspending(arguments: ActionArguments): ActionResult

Performs the action, with pre/post execution calls, if it accepts the provided arguments, suspending until the action completes.

Link copied to clipboard

Determines which thread runs the action.