Skip to content

Commit 4dbb4ee

Browse files
committed
Fixed up docs and default export
1 parent 8db9e7e commit 4dbb4ee

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ asyncTask();
7373
Or we can also use Node:
7474

7575
```javascript
76-
const AsBind = require("as-bind");
76+
const { AsBind } = require("as-bind");
7777
const fs = require("fs");
7878

7979
const wasm = fs.readFileSync("./path-to-my-wasm.wasm");

lib/lib.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ export const AsBind = {
1313
}
1414
};
1515

16-
export default AsBind;
16+
const AsBindLib = AsBind;
17+
export default AsBindLib;

test/test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const fs = require("fs");
22
const assert = require("assert");
3-
const asbind = require("../dist/asbind.cjs");
3+
const { AsBind } = require("../dist/asbind.cjs");
44

55
const wasmBytes = new Uint8Array(fs.readFileSync("./test/assembly/test.wasm"));
66

@@ -26,7 +26,7 @@ describe("asbind", () => {
2626
describe("instantiation", () => {
2727
it("should instantiate WebAssembly.Module", async () => {
2828
const wasmModule = await WebAssembly.compile(wasmBytes);
29-
asbindInstance = await asbind.instantiate(wasmModule, baseImportObject);
29+
asbindInstance = await AsBind.instantiate(wasmModule, baseImportObject);
3030

3131
assert(asbindInstance.exports !== undefined, true);
3232
assert(asbindInstance.exports.helloWorld !== undefined, true);
@@ -35,7 +35,7 @@ describe("asbind", () => {
3535
});
3636

3737
it("should instantiate Uint8Array", async () => {
38-
asbindInstance = await asbind.instantiate(wasmBytes, baseImportObject);
38+
asbindInstance = await AsBind.instantiate(wasmBytes, baseImportObject);
3939

4040
assert(asbindInstance.exports !== undefined, true);
4141
assert(asbindInstance.exports.helloWorld !== undefined, true);
@@ -56,7 +56,7 @@ describe("asbind", () => {
5656
});
5757
};
5858

59-
asbindInstance = await asbind.instantiate(
59+
asbindInstance = await AsBind.instantiate(
6060
Promise.resolve({
6161
bytes: wasmBytes
6262
}),
@@ -74,7 +74,7 @@ describe("asbind", () => {
7474
let asbindInstance;
7575

7676
before(async () => {
77-
asbindInstance = await asbind.instantiate(wasmBytes, baseImportObject);
77+
asbindInstance = await AsBind.instantiate(wasmBytes, baseImportObject);
7878
});
7979

8080
it("should allow passing high level types to asbind instance exports", () => {
@@ -171,7 +171,7 @@ describe("asbind", () => {
171171
}
172172
};
173173

174-
asbindInstance = await asbind.instantiate(
174+
asbindInstance = await AsBind.instantiate(
175175
wasmBytes,
176176
wrappedBaseImportObject
177177
);
@@ -245,7 +245,7 @@ describe("asbind", () => {
245245
}
246246
};
247247

248-
asbindInstance = await asbind.instantiate(
248+
asbindInstance = await AsBind.instantiate(
249249
wasmBytes,
250250
wrappedBaseImportObject
251251
);

0 commit comments

Comments
 (0)