guide: Add JsValue example to supported types section

This commit is contained in:
Nick Fitzgerald
2018-08-13 16:57:29 -07:00
parent fedd1a5440
commit 60307e81f9
4 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,10 @@
import {
take_js_value_by_value,
take_js_value_by_shared_ref,
return_js_value,
} from './guide_supported_types_examples';
take_js_value_by_value(42);
take_js_value_by_shared_ref('hello');
let v = return_js_value();

View File

@ -0,0 +1,12 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn take_js_value_by_value(x: JsValue) {}
#[wasm_bindgen]
pub fn take_js_value_by_shared_ref(x: &JsValue) {}
#[wasm_bindgen]
pub fn return_js_value() -> JsValue {
JsValue::NULL
}

View File

@ -9,3 +9,4 @@ pub mod str;
pub mod string;
pub mod char;
pub mod bool;
pub mod js_value;