mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-26 11:34:22 +03:00
feat(extends): extend promise
This commit is contained in:
parent
045138f397
commit
042cfad5ce
@ -3783,6 +3783,7 @@ extern {
|
||||
/// an asynchronous operation, and its resulting value.
|
||||
///
|
||||
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
||||
#[wasm_bindgen(extends = Object)]
|
||||
pub type Promise;
|
||||
|
||||
/// Creates a new `Promise` with the provided executor `cb`
|
||||
|
11
crates/js-sys/tests/wasm/Promise.rs
Normal file
11
crates/js-sys/tests/wasm/Promise.rs
Normal file
@ -0,0 +1,11 @@
|
||||
use wasm_bindgen_test::*;
|
||||
use wasm_bindgen::JsCast;
|
||||
use js_sys::*;
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn promise_inheritance() {
|
||||
let promise = Promise::new(&mut |_, _| ());
|
||||
assert!(promise.is_instance_of::<Promise>());
|
||||
assert!(promise.is_instance_of::<Object>());
|
||||
let _: &Object = promise.as_ref();
|
||||
}
|
@ -26,6 +26,7 @@ pub mod MapIterator;
|
||||
pub mod Math;
|
||||
pub mod Number;
|
||||
pub mod Object;
|
||||
pub mod Promise;
|
||||
pub mod Proxy;
|
||||
pub mod RangeError;
|
||||
pub mod ReferenceError;
|
||||
|
Loading…
Reference in New Issue
Block a user