moderator-toolbox-nxg-for-reddit / modules/shared/usernotes/store

modules/shared/usernotes/store

Functions

getSubredditNotes()

getSubredditNotes(subreddit): SubredditNoteState | undefined

Defined in: extension/data/modules/shared/usernotes/store.ts:19

Returns the current cached note state for a subreddit, or undefined if notes have not been loaded yet.

Parameters

subreddit

string

Returns

SubredditNoteState | undefined


publishSubredditNotes()

publishSubredditNotes(subreddit, state): void

Defined in: extension/data/modules/shared/usernotes/store.ts:28

Updates the note state for a subreddit and notifies all active subscribers.

Parameters

subreddit

string

The subreddit whose note state is being published.

state

SubredditNoteState

The new note state to publish.

Returns

void


subscribeSubredditNotes()

subscribeSubredditNotes(subreddit, listener): () => void

Defined in: extension/data/modules/shared/usernotes/store.ts:36

Subscribes to note state changes for a subreddit.

Parameters

subreddit

string

listener

NoteListener

Returns

An unsubscribe function that removes this listener.

() => void

Interfaces

SubredditNoteState

Defined in: extension/data/modules/shared/usernotes/store.ts:7

The current note data and color config for a subreddit, plus an error flag if loading failed.

Properties

colors

colors: UserNoteColor[]

Defined in: extension/data/modules/shared/usernotes/store.ts:9

error?

optional error?: boolean

Defined in: extension/data/modules/shared/usernotes/store.ts:11

True when the notes could not be loaded or the schema version is unsupported.

notes

Defined in: extension/data/modules/shared/usernotes/store.ts:8