webview_deno: local.ts example doesn't work on macos

$ git clone git@github.com:webview/webview_deno.git
Cloning into 'webview_deno'...
cd eremote: Enumerating objects: 999, done.
remote: Counting objects: 100% (303/303), done.
remote: Compressing objects: 100% (217/217), done.
remote: Total 999 (delta 163), reused 190 (delta 71), pack-reused 696
Receiving objects: 100% (999/999), 920.60 KiB | 5.86 MiB/s, done.
Resolving deltas: 100% (530/530), done.
^R
cd Brandons-MacBook-Air:Desktop brandonros 2022-01-26 22:48:59 $ cd webview_deno/
Brandons-MacBook-Air:webview_deno brandonros 2022-01-26 22:49:04 $ make build
cargo build
    Updating crates.io index
  Downloaded once_cell v1.9.0
  Downloaded 1 crate (30.7 KB) in 0.79s
   Compiling pkg-config v0.3.18
   Compiling cc v1.0.58
   Compiling once_cell v1.9.0
   Compiling webview-official-sys v0.1.2
   Compiling webview_deno v0.7.0-pre.0 (/Users/brandonros/Desktop/webview_deno)
    Finished dev [unoptimized + debuginfo] target(s) in 1m 15s
Brandons-MacBook-Air:webview_deno brandonros 2022-01-26 22:50:25 $ PLUGIN_URL=target/debug/  deno run --unstable -A examples/local.ts
Check file:///Users/brandonros/Desktop/webview_deno/examples/local.ts
Download target/debug/libwebview_deno.dylib

$ deno --version
deno 1.18.0 (release, aarch64-apple-darwin)
v8 9.8.177.6
typescript 4.5.2

image

just shows in the dock, click it and no window to be found anywhere

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Hi @eliassjogreen

I created a PR to fix the issue related to WebView on Darwin https://github.com/webview/webview_deno/pull/103

First: Must explicitly call set_size method on webview_sys

sys.symbols.deno_webview_set_size(this.#handle, width, height, hint);

I’m not sure about this one return encoder.encode(value + "\n"); in other platform but we need to remove ‘\n’ in Darwin so I do platform check for backward compatible.

image
image

Works great!

This issue should be closed now with #103. Thanks @hoangpq!

FYI make example spawns a webview instance inside a web worker (another thread). We need to update the example to run the webview instance on the main thread. This is not a Deno FFI bug.

I can’t find webview-official-sys dependency on GitHub.

https://docs.rs/crate/webview-official-sys/0.1.2/source/Cargo.toml

webview_create seems to return UnsafePointer find. webview_run seems to block but not create window but also not log an error/throw an exception. I will try to keep digging but I might hit brick wall as it is above my head.

Edit: found it, in here: https://github.com/webview/webview_rust/

The sample here works fine:

5 $ git clone --recurse-submodules -j8 git@github.com:webview/webview_rust.git
Cloning into 'webview_rust'...
remote: Enumerating objects: 486, done.
remote: Counting objects: 100% (50/50), done.
remote: Compressing objects: 100% (44/44), done.
remote: Total 486 (delta 19), reused 25 (delta 6), pack-reused 436
Receiving objects: 100% (486/486), 128.12 KiB | 2.07 MiB/s, done.
Resolving deltas: 100% (242/242), done.
Submodule 'webview-official' (https://github.com/webview/webview) registered for path 'webview-official-sys/webview-official'
Cloning into '/Users/brandonros/Desktop/webview_rust/webview-official-sys/webview-official'...
remote: Enumerating objects: 1736, done.        
remote: Counting objects: 100% (31/31), done.        
remote: Compressing objects: 100% (23/23), done.        
remote: Total 1736 (delta 16), reused 19 (delta 8), pack-reused 1705        
Receiving objects: 100% (1736/1736), 5.77 MiB | 4.86 MiB/s, done.
Resolving deltas: 100% (926/926), done.
Submodule path 'webview-official-sys/webview-official': checked out '7534ef6e476a1af6206ddb3d0efd3ebf131cba3c'
Brandons-MacBook-Air:Desktop brandonros 2022-02-10 13:33:32 $ cd webview_rust/
Brandons-MacBook-Air:webview_rust brandonros 2022-02-10 13:33:49 $ cargo build
    Updating crates.io index
  Downloaded pkg-config v0.3.24
  Downloaded 1 crate (16.5 KB) in 0.34s
   Compiling cc v1.0.72
   Compiling pkg-config v0.3.24
   Compiling webview-official-sys v0.1.2 (/Users/brandonros/Desktop/webview_rust/webview-official-sys)
   Compiling webview_official v0.2.0 (/Users/brandonros/Desktop/webview_rust)
    Finished dev [unoptimized + debuginfo] target(s) in 10.70s
Brandons-MacBook-Air:webview_rust brandonros 2022-02-10 13:34:09 $ cargo run --example sample
   Compiling webview_official v0.2.0 (/Users/brandonros/Desktop/webview_rust)
    Finished dev [unoptimized + debuginfo] target(s) in 0.23s
     Running `target/debug/examples/sample`
Hello World

image