Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to asynchronously call native function? #51

Open
GirkovArpa opened this issue Oct 17, 2021 · 1 comment
Open

How to asynchronously call native function? #51

GirkovArpa opened this issue Oct 17, 2021 · 1 comment
Labels

Comments

@GirkovArpa
Copy link

How to accomplish the same as the below using Python instead of Rust?


Rust

fn sum_async(&self, x: i32, y: i32, callback: Value) -> () {
    thread::spawn(move || {
        callback.call(None, &make_args!(x + y), None).unwrap();
    });
}

JavaScript

function sum_async(a, b) {
  return new Promise((resolve) => {
    Window.this.xcall('sum_async', a, b, resolve);
  });
}
@pravic
Copy link
Member

pravic commented Oct 18, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants