17 lines
474 B
TypeScript
17 lines
474 B
TypeScript
import { atom } from 'jotai';
|
|||
|
|
import { IContent } from 'matrix-js-sdk';
|
||
|
|
|
||
|
|
export type ScheduledMessage = {
|
||
|
|
delayId: string;
|
||
|
|
roomId: string;
|
||
|
|
content: IContent;
|
||
|
|
sendAt: number; // Unix timestamp ms
|
||
|
|
};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Global atom: Map<roomId, ScheduledMessage[]>
|
||
|
|
* Stores all locally-tracked scheduled messages across rooms.
|
||
|
|
* MSC4140 has no list endpoint, so we track them ourselves.
|
||
|
|
*/
|
||
|
|
export const scheduledMessagesAtom = atom<Map<string, ScheduledMessage[]>>(new Map());
|