-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
1790a28
commit a8e934d
Showing
4 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use wasm_bindgen::prelude::*; | ||
|
||
#[wasm_bindgen(inspectable)] | ||
pub struct Bar { | ||
pub foo: i32, | ||
_private: i32, | ||
} | ||
|
||
#[wasm_bindgen] | ||
impl Bar { | ||
#[wasm_bindgen(constructor)] | ||
pub fn new(foo: i32) -> Self { | ||
Self { foo, _private: 13 } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import * as wbg from "../pkg/typescript_tests"; | ||
|
||
const bar: wbg.Bar = new wbg.Bar(1); | ||
const barAsJson: Object = bar.toJSON(); | ||
const barAsString: string = bar.toString(); | ||
const _ = bar.foo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters