TaskOptions
Says what a task does when it is run again while a run is in flight: replace it, or reuse it.
Usage
Save without submitting twice
This type is used by task
import { Button, Text, VStack, task } from 'kuito';
export function SaveButton(props: { save: () => Promise<void> }) {
const save = task(() => props.save(), { policy: 'drop' });
return (
<VStack gap={8}>
<Button disabled={save.running.value} onPress={() => void save.run().catch(() => {})}>
{save.running.value ? 'Saving…' : 'Save changes'}
</Button>
<Text>{save.error.value ? 'Save failed. Try again.' : ''}</Text>
</VStack>
);
}Type declaration
export interface TaskOptions {
policy?: 'replace' | 'drop';
}Members 1
| Name | Type | Required | Description |
|---|---|---|---|
policy | "replace" | "drop" | No | — |
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.