Skip to content

Commit 2b43f43

Browse files
committed
fix: show proc if await is disabled
1 parent 108708f commit 2b43f43

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

webui.odin

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,15 @@ foreign webui {
163163
// Show a window using embedded HTML, or a file. If the window is already open, it will be refreshed.
164164
show :: proc(win: Window, content: string, await: bool = false, timeout: uint = 10) -> bool {
165165
res := webui_show(win, strings.unsafe_string_to_cstring(content))
166-
if !res {
167-
return false
166+
if !await {
167+
return res
168168
}
169-
if await {
170-
for _ in 0 ..< timeout * 100 {
171-
if is_shown(win) {
172-
return true
173-
}
174-
// Slow down check interval to reduce load.
175-
time.sleep(10 * time.Millisecond)
169+
for _ in 0 ..< timeout * 100 {
170+
if is_shown(win) {
171+
return true
176172
}
173+
// Slow down check interval to reduce load.
174+
time.sleep(10 * time.Millisecond)
177175
}
178176
return false
179177
}

0 commit comments

Comments
 (0)