Skip to content

Commit

Permalink
add some notes
Browse files Browse the repository at this point in the history
  • Loading branch information
lemarier committed Mar 30, 2021
1 parent 25c3351 commit ed10e91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/helloworld.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ wryApplication.run(({event}) => {
Deno.exit()
break;
case 'windowCreated':
console.log("It works! Window created");
console.log("It works! Window created , if webview didn't show, try to resize window");
break;
case 'domContentLoaded':
console.log("It works! domContentLoaded")
Expand Down
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ fn wry_new(json: Value, _zero_copy: &mut [ZeroCopyBuf]) -> Result<Value, AnyErro

let webview = WebViewBuilder::new(window)
.unwrap()
// inject a DOMContentLoaded listener to send a RPC request
.initialize_script("function __rpcDomContentLoaded() {rpc.call(\"domContentLoaded\", null);};window.addEventListener(\"DOMContentLoaded\", function () {__rpcDomContentLoaded();});")
.load_url(url)?
.set_rpc_handler(Box::new(move |req: RpcRequest| {

// this is a sample RPC test to check if we can get everything to work together
let response = None;
if &req.method == "domContentLoaded" {
STACK_MAP.with(|cell| {
Expand Down Expand Up @@ -99,8 +100,6 @@ fn wry_new(json: Value, _zero_copy: &mut [ZeroCopyBuf]) -> Result<Value, AnyErro
#[json_op]
fn wry_loop(json: Value, _zero_copy: &mut [ZeroCopyBuf]) -> Result<Value, AnyError> {
let id = json["id"].as_u64().unwrap();

//println!("ID {}", id);
let mut should_stop_loop = false;
EVENT_LOOP.with(|cell| {
let event_loop = &mut *cell.borrow_mut();
Expand Down Expand Up @@ -255,4 +254,4 @@ fn wry_set_visible(json: Value, _zero_copy: &mut [ZeroCopyBuf]) -> Result<Value,
Err(anyhow!("Could not find stack with id: {}", id))
}
})
}
}

0 comments on commit ed10e91

Please sign in to comment.