Skip to content

How to asynchronously call native function? #51

@GirkovArpa

Description

@GirkovArpa

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions