mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 12:50:01 +00:00
24 lines
501 B
TypeScript
24 lines
501 B
TypeScript
import { readable, type Updater } from "svelte/store";
|
|
import type { DialogInfo } from "$lib/types/dialog";
|
|
|
|
let update: (_: Updater<DialogInfo[]>) => void;
|
|
|
|
export default readable<DialogInfo[]>(
|
|
[],
|
|
(_, _update) => { update = _update }
|
|
);
|
|
|
|
export function createDialog(newData: DialogInfo) {
|
|
update((popups) => {
|
|
popups.push(newData);
|
|
return popups;
|
|
});
|
|
}
|
|
|
|
export function killDialog() {
|
|
update((popups) => {
|
|
popups.pop()
|
|
return popups;
|
|
});
|
|
}
|