You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
799 B
30 lines
799 B
import { writable } from 'svelte/store';
|
|
import Alert__SvelteComponent_ from './Alert.svelte';
|
|
export const content = writable("")
|
|
export const popup = writable(null)
|
|
import { bind } from 'svelte-simple-modal';
|
|
|
|
let val;
|
|
|
|
export async function show_popup(message, form = true, passwordInput = false) {
|
|
popup.set(bind(Alert__SvelteComponent_, {
|
|
message,
|
|
form,
|
|
passwordInput
|
|
}))
|
|
await waitForCondition()
|
|
}
|
|
|
|
export async function waitForCondition() {
|
|
const unsub = popup.subscribe((value) => { val = value })
|
|
async function checkFlag() {
|
|
if (val == null) {
|
|
unsub()
|
|
await new Promise(resolve => setTimeout(resolve, 100))
|
|
} else {
|
|
await new Promise(resolve => setTimeout(resolve, 200))
|
|
return await checkFlag()
|
|
}
|
|
}
|
|
return await checkFlag()
|
|
}
|
|
|