Closed alexlafroscia closed 5 years ago
This pull request is automatically deployed with Now. To access deployments, click Details below or on the icon next to each push.
Latest deployment for this branch: https://use-task-git-use-ref.alexlafroscia.now.sh
Inspired by React Refs and how they can be used to model mutable state within React, I have decided that it might be easier to organize the current state of a task in the same way, as it too can change over time.
This change allows a
TaskInstance
to be returned immediately after performing it, but still allows for handling a change in state the same way that one would handle any other change to a Ref.Now, properties about the state of a task will be accessed off of
TaskInstance.current
.The
.lastSuccessful
property was updated to be an instance ofTaskState
, since once a task has completed, the ability to await the result or cancel the task is irrelevant.