fn
useDocumentReadyState
v0.0.15testeddemoReactive `document.readyState` (`loading` | `interactive` | `complete`), updated on `readystatechange`.
Examples
ts
const readyState = useDocumentReadyState();
watch(readyState, (state) => {
if (state === 'complete') runAfterLoad();
});ts
useDocumentReadyState({
onChange: (state) => {
if (state === 'interactive') hydrate();
},
});Demo
Loading demo…
Signature
ts
export function useDocumentReadyState(
options: UseDocumentReadyStateOptions ={ ... }Parameters
| Parameter | Type | Description |
|---|---|---|
options? | UseDocumentReadyStateOptions | Options (custom `document`, `onChange` callback) |
Returns
UseDocumentReadyStateReturnThe current document ready state