useNotifications API
API reference for the useNotifications composable.
(options?: NotificationsOptions) => R<_E>(_options?: NotificationsPluginOptions | undefined) => ContextTrinity<_E>(_options?: NotificationsPluginOptions | undefined) => Plugin<_E>(namespace?: string) => _Eboolean | undefinedEnable event emission for registry operations
Default: false
boolean | undefinedEnable reactive behavior for registry operations
Default: false
number | undefinedDefault auto-dismiss timeout in ms for the toast queue.
Default: 3000
ReadonlyMap<ID, E>The collection of tickets in the registry
numberThe number of tickets in the registry
QueueContext<QueueTicketInput<unknown>, QueueTicket<QueueTicketInput<unknown>>>The toast display queue. Access `queue.values()`, `queue.pause()`, `queue.resume()`.
() => voidClear the entire registry
(id: ID) => booleanCheck if a ticket exists by ID
() => readonly ID[]Get all registered IDs
(value: E["value"]) => ID[] | undefinedBrowse for an ID(s) by value
(index: number) => ID | undefinedlookup a ticket by index number
(id: ID) => E | undefinedGet a ticket by ID
(id: ID, ticket?: Partial<Z>, event?: string) => EUpdate or insert a ticket by ID
() => readonly E[]Get all values of registered tickets
() => readonly [ID, E][]Get all entries of registered tickets
(ticket?: Partial<Z & RegistryTicket>) => ERegister a new ticket
(id: ID) => voidUnregister a ticket by ID
() => voidReset the index directory and update all tickets
(id: ID, toIndex: number) => E | undefinedSeek for a ticket based on direction and optional predicate
(direction?: "first" | "last", from?: number, predicate?: (ticket) => boolean) => E | undefined<K extends Extensible<RegistryEventName>>(event: K, cb: EventHandler<E, K>) => voidListen for registry events
<K extends Extensible<RegistryEventName>>(event: K, cb: EventHandler<E, K>) => voidStop listening for registry events
<K extends Extensible<RegistryEventName>>(event: K, data: EventPayload<E, K>) => voidEmit an event with data
() => voidClears the registry and removes all listeners
(registrations: Partial<Z & RegistryTicket>[]) => E[]Onboard multiple tickets at once
(ids: ID[]) => voidOffboard multiple tickets at once
<R>(fn: () => R) => RExecute operations in a batch, deferring cache invalidation and event emission until complete
(input: Z) => ECreate a notification and enqueue for toast display.
(id: ID) => voidMark as read. Emits `notification:read`.
(id: ID) => voidMark as unread. Emits `notification:unread`.
(id: ID) => voidMark as seen. Emits `notification:seen`.
(id: ID) => voidArchive. Emits `notification:archived`.
(id: ID) => voidRestore from archive. Emits `notification:unarchived`.
(id: ID, until: Date) => voidSnooze until the given time. Emits `notification:snoozed`.
(id: ID) => voidCancel snooze. Emits `notification:unsnoozed`.
() => voidMark all unread notifications as read.
() => voidArchive all unarchived notifications.