shelving
Version:
Toolkit for using data in JavaScript.
17 lines (16 loc) • 669 B
JavaScript
import { ArrayStore } from "../../store/ArrayStore.js";
import { awaitDispose } from "../../util/dispose.js";
import { NoticeStore } from "./NoticeStore.js";
/** Store a list of notices. */
export class NoticesStore extends ArrayStore {
/** Show a notice with an optional status. */
show(children, status) {
return new NoticeStore(this, children, status);
}
async [Symbol.asyncDispose]() {
await awaitDispose(...this.value, // Dispose all notices when we dispose.
super[Symbol.asyncDispose]());
}
}
/** Create a global list of shown notices allowing any of the default statuses. */
export const NOTICES = new NoticesStore();