scope
Register cleanup in the active reactive scope when one exists.
| Package | @vizejs/composable/scope |
| Own the source | vize lib pull composable:scope |
| Runtime exports | tryOnScopeDispose |
| Gzip budget | 512 B |
Usage
import { tryOnScopeDispose } from "@vizejs/composable/scope";
Runtime contract
| Utility | Category | Stability | SSR | Hydration | Cleanup | Targets | Host globals | Uses |
|---|---|---|---|---|---|---|---|---|
tryOnScopeDispose |
lifecycle | experimental | safe | not-applicable | reactive-scope | web, server, worker, native, desktop, terminal | — | — |
API
tryOnScopeDispose
Register cleanup in the active reactive scope when one exists. This is the shared lifecycle primitive of the package: composables hand their teardown here so owned resources are released when the surrounding scope stops. Never throws and is safe during server rendering; no browser globals are read. When no scope is active the cleanup is not registered and disposal ownership stays with the caller.
function tryOnScopeDispose(cleanup: () => void): boolean