add native window/webview builtins to el runtime
Adds five new builtins backed by wry 0.47 + tao 0.30: - window_open(title, width, height) — configure window - webview_load_url(url) — set URL to navigate to - webview_load_html(html) — set HTML to display - webview_eval(js) — queue JS to eval after load - window_run() — open native OS window and run event loop (blocking, exits on close) WebViewState is stored in a thread_local. window_run() calls tao's event_loop.run() which never returns; process exits when the window is closed via std::process::exit(0).
This commit is contained in:
@@ -262,6 +262,13 @@ impl TypeEnv {
|
||||
env.functions.insert("cursor_col".into(), str_fn(vec![i.clone()], Type::Void));
|
||||
env.functions.insert("http_sse_post".into(), str_fn(vec![s.clone(), s.clone(), s.clone()], s.clone()));
|
||||
|
||||
// Native window / WebView builtins
|
||||
env.functions.insert("window_open".into(), str_fn(vec![s.clone(), i.clone(), i.clone()], Type::Void));
|
||||
env.functions.insert("webview_load_url".into(), str_fn(vec![s.clone()], Type::Void));
|
||||
env.functions.insert("webview_load_html".into(), str_fn(vec![s.clone()], Type::Void));
|
||||
env.functions.insert("webview_eval".into(), str_fn(vec![s.clone()], Type::Void));
|
||||
env.functions.insert("window_run".into(), str_fn(vec![], Type::Void));
|
||||
|
||||
// Math
|
||||
for name in &["math_abs","math_floor","math_ceil","math_round","math_sqrt"] {
|
||||
env.functions.insert(name.to_string(), str_fn(vec![u.clone()], u.clone()));
|
||||
|
||||
Reference in New Issue
Block a user