Skip to main content
zerotal

Documentation


Documentation / @zerotal/notifications / NotificationRegistry

Variable: NotificationRegistry

const NotificationRegistry: object

Defined in: notifications/src/NotificationRegistry.ts:23

Global registry mapping notification class names to their constructors.

A queued notification is stored as { type, data } — the class name plus the result of payload(). When a worker picks the job up it has only those two strings, so the class must be reachable by name to be rebuilt. That is what this registry provides.

Registration is automatic in the common case: discoverNotifications imports app/notifications/*.ts and registers every exported notification class. Call register() yourself only for notifications that live elsewhere.

Type Declaration

_map

_map: Map<string, NotificationClass>

register()

register(NotificationClass): void

Parameters

NotificationClass

NotificationClass

Returns

void

resolve()

resolve(className): NotificationClass | undefined

Parameters

className

string

Returns

NotificationClass | undefined

all()

all(): ReadonlyMap<string, NotificationClass>

Returns

ReadonlyMap<string, NotificationClass>