hello/hello.rs
1use miniblink_sys::*;
2
3fn main() {
4 unsafe {
5 let lib = Library::new("mb108_x32.dll").unwrap();
6 // let lib = Library::new("./miniblink.so").unwrap();
7 let settings = std::mem::zeroed();
8 lib.mbInit(&settings);
9 let webview =
10 lib.mbCreateWebWindow(MB_WINDOW_TYPE_POPUP, std::ptr::null_mut(), 20, 20, 200, 200);
11 lib.mbLoadURL(webview, c"http://example.com".as_ptr());
12 lib.mbShowWindow(webview, 1);
13 lib.mbRunMessageLoop();
14 }
15
16 // app::js_bind_function(
17 // "hello",
18 // |es: JsExecState| -> MBResult<JsValue> {
19 // let arg1: String = es.arg_value(0)?;
20 // let result = format!("Hello, {}!", arg1);
21 // es.js_value(result)
22 // },
23 // 1,
24 // );
25
26 // let wv = WebView::default();
27 // wv.set_window_title("Hello, Miniblink");
28 // wv.load_html(
29 // r#"
30 // <html>
31 // <head>
32 // <title>Hello, world!</title>
33 // </head>
34 // <body>
35 // <input id="input1"></input>
36 // <input id="input2" disabled></input>
37 // <button onclick="say_hello();">Hello</button>
38 // <script>
39 // var say_hello = function(){
40 // var input1=document.getElementById('input1');
41 // var input2=document.getElementById('input2');
42 // input2.value=window.hello(input1.value);
43 // }
44 // </script>
45 // </body>
46 // </html>
47 // "#,
48 // );
49
50 // wv.on_window_closing(|_| {
51 // std::process::exit(0);
52 // });
53
54 // wv.show_window(true);
55 // app::run_message_loop();
56}