sciter-sdk/pysciter

How to asynchronously call native function?

GirkovArpa opened this issue · 1 comments

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);
  });
}