Skip to content

basalt / notifications/src / NotificationPreferences

Class: NotificationPreferences ​

Defined in: notifications/src/preferences.ts:49

Constructors ​

Constructor ​

> new NotificationPreferences(store): NotificationPreferences

Defined in: notifications/src/preferences.ts:50

Parameters ​

store ​

PreferenceStore

Returns ​

NotificationPreferences

Methods ​

allowed() ​

> allowed(userId, notification, channel): Promise<boolean>

Defined in: notifications/src/preferences.ts:65

Whether a (notification, channel) may be sent to a user — the most specific preference decides; default allowed.

Parameters ​

userId ​

string

notification ​

string

channel ​

string

Returns ​

Promise<boolean>


list() ​

> list(userId): Promise<NotificationPreference[]>

Defined in: notifications/src/preferences.ts:60

Parameters ​

userId ​

string

Returns ​

Promise<NotificationPreference[]>


optIn() ​

> optIn(userId, target?): Promise<void>

Defined in: notifications/src/preferences.ts:57

Re-enable a notification/channel.

Parameters ​

userId ​

string

target? ​
channel? ​

string

notification? ​

string

Returns ​

Promise<void>


optOut() ​

> optOut(userId, target?): Promise<void>

Defined in: notifications/src/preferences.ts:53

Silence a notification/channel (defaults to all: { } mutes everything).

Parameters ​

userId ​

string

target? ​
channel? ​

string

notification? ​

string

Returns ​

Promise<void>

Released under the MIT License.