Closed NullVoxPopuli closed 3 months ago
import { Signal } from 'signal-polyfill'; import { signalFunction } from 'signal-utils/async-function'; const url = new Signal.State('...'); const signalResponse = signalFunction(async () => { const response = await fetch(url.get()); // entangles with `url` // after an away, you've detatched from the signal-auto-tracking return response.json(); }); // output: true // after the fetch finishes // output: false <template> <output>{{signalResponse.isLoading}}</output> </template>
the signalResponse object has familiar properties on it:
signalResponse
value
error
state
isResolved
isPending
isRejected
the
signalResponse
object has familiar properties on it:value
error
state
isResolved
isPending
isRejected