js-sys: Add extends attributes for js_sys::Uint8Array

This commit is contained in:
Sendil Kumar 2018-08-14 19:29:13 +02:00
parent f617dee794
commit ea0ac134db
2 changed files with 20 additions and 0 deletions

View File

@ -2539,6 +2539,7 @@ extern {
// Uint8Array
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type Uint8Array;

View File

@ -1,7 +1,26 @@
use wasm_bindgen::prelude::*;
use wasm_bindgen_test::*;
use wasm_bindgen::JsCast;
use js_sys::*;
macro_rules! each {
($m:ident) => (
$m!(Uint8Array);
)
}
macro_rules! test_inheritence {
($arr:ident) => ({
let arr = $arr::new(&JsValue::undefined());
assert!(arr.is_instance_of::<Uint8Array>());
assert!(arr.is_instance_of::<Object>());
})
}
#[wasm_bindgen_test]
fn inheritence() {
each!(test_inheritence);
}
macro_rules! each {
($m:ident) => (
$m!(Uint8Array);