moderator-toolbox-nxg-for-reddit / modules/modactions/recentActionsStore
modules/modactions/recentActionsStore¶
Functions¶
ensureRecentActionsLoaded()¶
ensureRecentActionsLoaded(
subreddit):void
Defined in: extension/data/modules/modactions/recentActionsStore.ts:45
Fetches the subreddit mod log once and caches it. Safe to call repeatedly (and on every render): a successful result is cached, concurrent calls are de-duplicated, and a failed fetch is retried only after a cooldown - so a transient error neither hammers a failing endpoint nor hides the “Recent actions” button for the rest of the session.
Parameters¶
subreddit¶
string
Bare subreddit name (no r/ prefix).
Returns¶
void
getRecentActions()¶
getRecentActions(
subreddit,itemId):ModLogEntry[] |undefined
Defined in: extension/data/modules/modactions/recentActionsStore.ts:82
The cached mod-log entries that target itemId, or undefined when the subreddit’s window has
not been fetched yet. Lets the popup render from the already-fetched window instead of re-fetching.
Parameters¶
subreddit¶
string
Bare subreddit name (no r/ prefix).
itemId¶
string
Thing fullname (t3_.../t1_...).
Returns¶
ModLogEntry[] | undefined
itemHasRecentActions()¶
itemHasRecentActions(
subreddit,itemId):boolean
Defined in: extension/data/modules/modactions/recentActionsStore.ts:72
Whether the given item has a recent mod-log action (and thus something for the “Recent actions”
popup to show). Returns false until the subreddit’s log has been fetched via
ensureRecentActionsLoaded.
Parameters¶
subreddit¶
string
Bare subreddit name (no r/ prefix).
itemId¶
string
Thing fullname (t3_.../t1_...).
Returns¶
boolean
subscribeRecentActions()¶
subscribeRecentActions(
listener): () =>void
Defined in: extension/data/modules/modactions/recentActionsStore.ts:91
Subscribes to index changes.
Parameters¶
listener¶
() => void
Called on every change.
Returns¶
An unsubscribe function.
() => void