Vizel API / svelte/src / setVizelContext
Function: setVizelContext()
ts
function setVizelContext(accessor): VizelContextAccessor;Defined in: packages/svelte/src/components/VizelContext.ts:34
Publish the editor accessor to descendants through Svelte context.
Call this typed wrapper instead of setContext(VIZEL_CONTEXT_KEY, ...) so the key and the VizelContextAccessor value type stay paired at every call site. setVizelContext / getVizelContext are the Svelte context idiom; <Vizel> and <VizelProvider> both publish the editor through this function.
Parameters
| Parameter | Type | Description |
|---|---|---|
accessor | VizelContextAccessor | Reactive accessor whose current getter returns the live editor instance, or null before mount. |
Returns
The accessor, so a caller can publish and reuse it in one expression.