This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import notifications from "./Notification"; | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { writable } from "svelte/store"; | |
import type { Writable } from "svelte/store"; | |
const TIMEOUT = 3000; | |
type MessageType = "default" | "danger" | "warning" | "info" | "success"; | |
export interface Msg { | |
type: MessageType; | |
message: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
setTimeout( | |
() => { | |
notificationStore.update((n) => { | |
return n.filter((m) => m.id !== id); | |
}); | |
}, | |
msg?.timeout ? msg.timeout : TIMEOUT | |
); | |
// ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const notifications = { | |
// ... | |
remove: (id: string) => { | |
notificationStore.update((n) => { | |
return n.filter((m) => m.id !== id); | |
}); | |
}, | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const notifications = { | |
// ... | |
send: (msg: Msg, id: string = idGenerator()) => { | |
notificationStore.update((n) => { | |
return [...n, { id, msg }]; | |
}); | |
}, | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const idGenerator = (): string => "_" + Math.random().toString(36).substring(2, 9); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { writable } from "svelte/store"; | |
import type { Writable } from "svelte/store"; | |
const TIMEOUT = 3000; | |
type MessageType = "default" | "danger" | "warning" | "info" | "success"; | |
export interface Msg { | |
type: MessageType; | |
message: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { spawn } from "child_process"; | |
function serve() { | |
let server; | |
function toExit() { | |
if (server) server.kill(0); | |
} | |
return { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function serve() { | |
let server; | |
function toExit() { | |
if (server) server.kill(0); | |
} | |
return { | |
writeBundle() { | |
if (server) return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import css from "@el3um4s/rollup-plugin-css-only"; | |
import { terser } from "@el3um4s/rollup-plugin-terser"; |