Skip to content

Function: createRbacState() ​

ts
function createRbacState<T, G>(snapshot, options?): SvelteRbac<T, G>;

Defined in: packages/sveltekit/src/context.svelte.ts:59

Creates the reactive state without putting it in the context (setRbacContext() does both). Useful in tests: render(Component, { context: new Map([[RBAC_KEY, createRbacState(snapshot)]]) }).

Type Parameters ​

Type ParameterDefault type
T extends RbacTypeConfig | Rbac<RbacTypeConfig>DefaultRbacTypes
G extends stringDefaultGuardName<TypesOf<T>>

Parameters ​

ParameterType
snapshotRbacSnapshotSource
options?RbacCheckerOptions

Returns ​

SvelteRbac<T, G>

Released under the MIT License. Inspired by spatie/laravel-permission.