-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Teach as-bind to recognize external decorator. (#95)
- Loading branch information
Showing
3 changed files
with
62 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@external("my_module", "my_log") | ||
declare function log(str: string): void; | ||
|
||
@external("my_log2") | ||
declare function log2(str: string): void; | ||
|
||
export function fn(): void { | ||
log("ok"); | ||
log2("fine"); | ||
} |
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,24 @@ | ||
describe("as-bind", function() { | ||
it("should support @external imports", async function() { | ||
let from_wasm; | ||
let from_wasm2; | ||
|
||
const instance = await AsBind.instantiate(this.rawModule, { | ||
my_module: { | ||
my_log(str) { | ||
from_wasm = str; | ||
} | ||
}, | ||
asc: { | ||
my_log2(str) { | ||
from_wasm2 = str; | ||
} | ||
} | ||
}); | ||
|
||
instance.exports.fn(); | ||
|
||
assert(from_wasm === "ok"); | ||
assert(from_wasm2 === "fine"); | ||
}); | ||
}); |
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