Skip to content

Vizel API / svelte/src / getVizelContextSafe

Function: getVizelContextSafe()

ts
function getVizelContextSafe(): VizelContextAccessor | null;

Defined in: packages/svelte/src/components/VizelContext.ts:80

Get the editor instance accessor from context.

Returns null when called outside of VizelProvider (does not throw). Mirrors getVizelContext but is non-throwing so optional consumers (e.g. components that work both inside and outside a provider) can fall back gracefully.

The null sentinel matches the React / Vue equivalents (useVizelContextSafe) — every framework returns null when no provider is present.

Returns

VizelContextAccessor | null

Released under the MIT License.