useFeatures API
API reference for the useFeatures composable.
(_options?: FeatureOptions) => RCreates a new features instance.
(_options?: FeatureContextOptions) => ContextTrinity<R>Creates a new features context.
(_options?: FeaturePluginOptions) => anyCreates a new features plugin.
(namespace?: string) => RReturns the current features instance.
booleanEnable event emission for registry operations
Default: false
booleanEnable reactive behavior for registry operations
Default: false
Record<ID, any>Static feature flags to register.
ReadonlyMap<ID, Z>The collection of tickets in the registry
numberThe number of tickets in the registry
Reactive<Set<ID>>Set of selected ticket IDs
ComputedRef<Set<E>>Set of selected ticket instances
ComputedRef<Set<unknown>>Set of selected ticket values
MaybeRef<boolean>Disable state for the entire selection instance
Reactive<Set<ID>>Set of mixed/indeterminate ticket IDs
ComputedRef<Set<E>>Set of mixed/indeterminate ticket instances
ComputedRef<boolean>Whether no items are currently selected
ComputedRef<boolean>Whether all selectable (non-disabled) items are selected
ComputedRef<boolean>Whether some but not all selectable items are selected
() => voidClear the entire registry
(id: ID) => booleanCheck if a ticket exists by ID
() => readonly ID[]Get all registered IDs
(value: Z["value"]) => ID[] | undefinedBrowse for an ID(s) by value
(index: number) => ID | undefinedlookup a ticket by index number
(id: ID) => Z | undefinedGet a ticket by ID
(id: ID, ticket?: Partial<Z>) => ZUpdate or insert a ticket by ID
() => readonly Z[]Get all values of registered tickets
() => readonly [ID, Z][]Get all entries of registered tickets
(id: ID) => voidUnregister a ticket by ID
() => voidReset the index directory and update all tickets
(direction?: "first" | "last", from?: number, predicate?: (ticket) => boolean) => Z | undefinedSeek for a ticket based on direction and optional predicate
<K extends Extensible<RegistryEventName>>(event: K, cb: EventHandler<Z, K>) => voidListen for registry events
<K extends Extensible<RegistryEventName>>(event: K, cb: EventHandler<Z, K>) => voidStop listening for registry events
<K extends Extensible<RegistryEventName>>(event: K, data: EventPayload<Z, K>) => voidEmit an event with data
() => voidClears the registry and removes all listeners
(ids: ID[]) => voidOffboard multiple tickets at once
<R>(fn: () => R) => RExecute operations in a batch, deferring cache invalidation and event emission until complete
() => voidClear all selected IDs and reindexes
(id: ID) => booleanCheck if a ticket is selected by ID
() => voidMandates selected ID based on "mandatory" Option
(ids: ID | ID[]) => voidSelect one or more Tickets by ID
(ids: ID | ID[]) => voidUnselect one or more Tickets by ID
(ids: ID | ID[]) => voidToggle one or more Tickets ON and OFF by ID
(ids: ID | ID[]) => voidSet one or more Tickets to mixed/indeterminate state by ID
(ids: ID | ID[]) => voidClear mixed/indeterminate state from one or more Tickets by ID
(id: ID) => booleanCheck if a ticket is in mixed/indeterminate state by ID
() => voidSelect all selectable (non-disabled) items
() => voidUnselect all items (respects mandatory option)
() => voidToggle between all selected and none selected
(registrations: Partial<Z>[]) => E[]Onboard multiple tickets at once
(id: ID, fallback?: unknown) => unknownGet the variation value of a feature, or a fallback if not set.
(flags: FeaturesAdapterFlags) => voidSync feature flags from an external source.
(registration?: Partial<Z>) => ERegister a feature (accepts input type, returns output type)