moderator-toolbox-nxg-for-reddit / background/messages

background/messages

Interfaces

TbCacheForceTimeoutMessage

Defined in: extension/data/background/messages.ts:62

Forces all TTL-governed cache entries to expire immediately.

Properties

action

action: "toolbox-cache-force-timeout"

Defined in: extension/data/background/messages.ts:63


TbGlobalMessage

Defined in: extension/data/background/messages.ts:126

Broadcasts an event to all open Reddit tabs (and optionally the background).

Properties

action

action: "toolbox-global"

Defined in: extension/data/background/messages.ts:127

excludeBackground?

optional excludeBackground?: boolean

Defined in: extension/data/background/messages.ts:133

If true, the background page is skipped and only tabs receive the event.

globalEvent

globalEvent: string

Defined in: extension/data/background/messages.ts:129

The event name to re-dispatch in each tab.

payload?

optional payload?: unknown

Defined in: extension/data/background/messages.ts:131

Optional data to include with the event.


TbModqueueMessage

Defined in: extension/data/background/messages.ts:137

Asks the background whether a given thing is currently in a subreddit’s modqueue.

Properties

action

action: "toolbox-modqueue"

Defined in: extension/data/background/messages.ts:138

subreddit

subreddit: string

Defined in: extension/data/background/messages.ts:139

thingName

thingName: string

Defined in: extension/data/background/messages.ts:141

Fullname of the thing to look up (e.g. t3_abc123).

thingTimestamp

thingTimestamp: number

Defined in: extension/data/background/messages.ts:143

Unix seconds timestamp of the thing; used to detect stale cache entries.


TbNotificationDetails

Defined in: extension/data/background/messages.ts:87

Payload describing a notification to display.

Properties

body

body: string

Defined in: extension/data/background/messages.ts:91

Body text.

title

title: string

Defined in: extension/data/background/messages.ts:89

Heading text.

url

url: string

Defined in: extension/data/background/messages.ts:93

URL to open when the notification is clicked.


TbNotificationMessage

Defined in: extension/data/background/messages.ts:97

Requests the background to show a notification.

Properties

action

action: "toolbox-notification"

Defined in: extension/data/background/messages.ts:98

details

Defined in: extension/data/background/messages.ts:101

native

native: boolean

Defined in: extension/data/background/messages.ts:100

If true, displays a native browser notification; otherwise an in-page overlay.


TbOverwriteAllSettingsMessage

Defined in: extension/data/background/messages.ts:78

Replaces the entire tbsettings object in storage with newSettings.

Properties

action

action: "toolbox-overwrite-all-settings"

Defined in: extension/data/background/messages.ts:79

newSettings

newSettings: Record<string, unknown>

Defined in: extension/data/background/messages.ts:81

The full settings object to write; must be a plain object.


TbPageNotificationClearMessage

Defined in: extension/data/background/messages.ts:112

Notifies the background that an in-page notification was dismissed.

Properties

action

action: "toolbox-page-notification-clear"

Defined in: extension/data/background/messages.ts:113

id

id: string

Defined in: extension/data/background/messages.ts:115

The notification’s UUID.


TbPageNotificationClickMessage

Defined in: extension/data/background/messages.ts:105

Notifies the background that an in-page notification was clicked.

Properties

action

action: "toolbox-page-notification-click"

Defined in: extension/data/background/messages.ts:106

id

id: string

Defined in: extension/data/background/messages.ts:108

The notification’s UUID.


TbReloadMessage

Defined in: extension/data/background/messages.ts:121

Requests the background to call browser.runtime.reload().

Properties

action

action: "toolbox-reload"

Defined in: extension/data/background/messages.ts:122


TbRequestMessage

Defined in: extension/data/background/messages.ts:14

Message sent by content scripts to ask the background to perform an HTTP request.

Properties

absolute?

optional absolute?: boolean

Defined in: extension/data/background/messages.ts:22

action

action: "toolbox-request"

Defined in: extension/data/background/messages.ts:15

body?

optional body?: string | Record<string, string | undefined> | { data: unknown; type: "json"; }

Defined in: extension/data/background/messages.ts:19

endpoint

endpoint: string

Defined in: extension/data/background/messages.ts:17

method?

optional method?: string

Defined in: extension/data/background/messages.ts:16

oauth?

optional oauth?: boolean

Defined in: extension/data/background/messages.ts:20

okOnly?

optional okOnly?: boolean

Defined in: extension/data/background/messages.ts:21

query?

optional query?: Record<string, string | number | boolean | undefined>

Defined in: extension/data/background/messages.ts:18


TbUpdateSettingsMessage

Defined in: extension/data/background/messages.ts:69

Applies a partial settings update: merges new values and removes deleted keys.

Properties

action

action: "toolbox-update-settings"

Defined in: extension/data/background/messages.ts:70

deletedSettings?

optional deletedSettings?: string[]

Defined in: extension/data/background/messages.ts:74

Keys to remove from tbsettings.

updatedSettings?

optional updatedSettings?: Record<string, unknown>

Defined in: extension/data/background/messages.ts:72

Keys and new values to write into tbsettings.


TbUsernoteDecompressMessage

Defined in: extension/data/background/messages.ts:149

Asks the background to decompress a usernotes wiki blob and return the parsed user map.

Properties

action

action: "toolbox-usernote-decompress"

Defined in: extension/data/background/messages.ts:150

blob

blob: string

Defined in: extension/data/background/messages.ts:157

Base64-encoded zlib-compressed JSON blob from the usernotes wiki page.

cacheKey

cacheKey: string

Defined in: extension/data/background/messages.ts:155

Cache key for in-memory caching and deduplication: the subreddit for the legacy page, or a per-shard subreddit#shard key for sharded NXG pages.

Type Aliases

SerializedResponse

SerializedResponse = [string, ResponseInit]

Defined in: extension/data/background/messages.ts:9

Serialized fetch response: constructor arguments that can be sent over the message channel.


TbCacheMessage

TbCacheMessage = TbCacheGetMessage | TbCacheSetMessage | TbCacheClearMessage

Defined in: extension/data/background/messages.ts:59

Union of all cache operation messages.


TbRequestResponse

TbRequestResponse = { error?: never; response: SerializedResponse; } | { error: true; message?: string; response?: SerializedResponse; }

Defined in: extension/data/background/messages.ts:30

Reply shape for a toolbox-request message. On success, response holds the serialized fetch response. On error, error is true and message describes what went wrong.


TbUsernoteDecompressResponse

TbUsernoteDecompressResponse = { users: Record<string, unknown>; } | { error: string; }

Defined in: extension/data/background/messages.ts:165

Reply shape for a toolbox-usernote-decompress message. On success, users is the parsed user-to-notes map. On failure, error is a stringified error description.


ToolboxMessage

Defined in: extension/data/background/messages.ts:172

Union of all messages handled by the background service worker.


ToolboxMessageAction

ToolboxMessageAction = ToolboxMessage["action"]

Defined in: extension/data/background/messages.ts:187

Union of all valid action strings for background messages.