Task Instance
Structure
To standardize the approach regardless of which task modifier you’re using, every task modifier will use the same underlying TaskInstance
structure inside of a svelte store.
A TaskInstance
comprises of:
error
: if an error is thrown inside the task instance, it will be found herehasStarted
: it is possible for the task instance to be in a queue, waiting to start. This property will change totrue
the instant the task instance has startedisCanceled
: whether the task instance was canceledisError
: whether the task instance throw an error before completingisRunning
: whether the task instance is currently runningisSuccessful
: whether the task instance completed successfullyvalue
: if the task instance completed successfully, this will be the return value
And for those of you that prefer to read code, here is the typing of the TaskInstance
:
You can access these properties just as you would with any other Svelte store:
Cancellation
Each task instance is also packaged with a cancel
function that can be used to cancel itself.