Pheuw1
2 years ago
1 changed files with 27 additions and 2 deletions
@ -1,4 +1,29 @@ |
|||||
import { writable } from 'svelte/store'; |
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) { |
||||
|
popup.set(bind(Alert__SvelteComponent_, { |
||||
|
message, |
||||
|
form |
||||
|
})) |
||||
|
await waitForCondition() |
||||
|
} |
||||
|
|
||||
export const content = writable("init") |
export async function waitForCondition() { |
||||
export const popup = writable(null) |
const unsub = popup.subscribe((value) => {val = value}) |
||||
|
async function checkFlag() { |
||||
|
if (val == null) { |
||||
|
console.log("finished",val) |
||||
|
unsub() |
||||
|
return new Promise(resolve => setTimeout(resolve, 0)); |
||||
|
} else { |
||||
|
console.log("waiting") |
||||
|
await new Promise(resolve => setTimeout(resolve, 1000)); |
||||
|
return await checkFlag(); |
||||
|
} |
||||
|
} |
||||
|
return await checkFlag() |
||||
|
} |
Loading…
Reference in new issue