Sheepdog Utils
When creating a task (of any type) there are 2 possible arguments that can be accessed, the first is any argument that is passed in when calling .perform()
, and the second is an object that can be used to optionally enhance your task - SheepdogUtils
.
SheepdogUtils
offers two properties to extend your task with:
signal
- theAbortSignal
is available so that you can do any further manipulation you need based on the state of theAbortSignal
. We won’t go into too much detail about this as it is the standardAbortSignal
interface that is simply passed back fromSheepdog
.link
- this is aSheepdog
specific function that allows you to bind tasks together. For more information, check out the Linking Tasks explainer.
<script lang="ts"> import { task } from '@sheepdog/svelte';
const myTask = task(async (myArgument, {signal, link}) => { // your code });</script>
type SheepdogUtils = { signal: AbortSignal; link: <TArgs, TReturn>(task: Task<TArgs, TReturn>) => Task<TArgs, TReturn>;};