File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -159,33 +159,32 @@ foreign webui {
159159
160160// == Wrapper functions =======================================================
161161
162+ Error :: enum {
163+ None,
164+ Failed,
165+ }
162166
163167// Show a window using embedded HTML, or a file. If the window is already open, it will be refreshed.
164- show :: proc (win: Window, content: string , await: bool = false , timeout: uint = 10 ) -> bool {
168+ show :: proc (win: Window, content: string , await: bool = false , timeout: uint = 10 ) -> Error {
165169 res := webui_show (win, strings.unsafe_string_to_cstring (content))
166170 if !await {
167- return res
171+ return .Failed
168172 }
169173 for _ in 0 ..< timeout * 100 {
170174 if is_shown (win) {
171- return true
175+ return nil
172176 }
173177 // Slow down check interval to reduce load.
174178 time.sleep (10 * time.Millisecond)
175179 }
176- return false
180+ return .Failed
177181}
178182
179183// Navigate to a specific URL
180184navigate :: proc (win: Window, url: string ) {
181185 webui_navigate (win, strings.unsafe_string_to_cstring (url))
182186}
183187
184- Error :: enum {
185- None,
186- Failed,
187- }
188-
189188// Run JavaScript without waiting for the response.
190189run :: proc (win: Window, script: string ) {
191190 webui_run (win, strings.unsafe_string_to_cstring (script))
You can’t perform that action at this time.
0 commit comments