File size: 501 Bytes
43a06dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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;
    });
}