Skip to content

Commit cb2f68e

Browse files
committed
QOL
1 parent 6688eb8 commit cb2f68e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

playgrounds/sandbox/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
import { mount, hydrate, unmount } from 'svelte';
1515
import App from '/src/App.svelte';
1616

17+
globalThis.delayed = (v, ms = 1000) => {
18+
return new Promise((f) => {
19+
setTimeout(() => f(v), ms);
20+
});
21+
};
22+
1723
const root = document.getElementById('root');
1824
const render = root.firstChild?.nextSibling ? hydrate : mount;
1925

playgrounds/sandbox/ssr-common.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ Promise.withResolvers ??= () => {
99

1010
return { promise, resolve, reject };
1111
};
12+
13+
globalThis.delayed = (v, ms = 1000) => {
14+
return new Promise((f) => {
15+
setTimeout(() => f(v), ms);
16+
});
17+
};

0 commit comments

Comments
 (0)