-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add browser support; Fixed memory leak
- Loading branch information
1 parent
93d6243
commit ebdcd62
Showing
13 changed files
with
103 additions
and
28 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.gitignore | ||
*.pre | ||
*.o | ||
*.wast |
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
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
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,28 @@ | ||
import { getImageData } from './utils'; | ||
import { getInstance, getMemoryGrowTimestamp } from '../instance'; | ||
import { scanImageData } from '../module'; | ||
|
||
test('Multiple Scan Test', async () => { | ||
const inst = await getInstance(); | ||
const dir = __dirname + '/../../src/test'; | ||
let res; | ||
const img4 = await getImageData(dir + '/test4.png'); | ||
res = await scanImageData(img4); | ||
expect(res).toHaveLength(2); | ||
|
||
let t1 = getMemoryGrowTimestamp(); | ||
inst.malloc(100000000); | ||
let t2 = getMemoryGrowTimestamp(); | ||
expect(t1).not.toEqual(t2); | ||
t1 = t2; | ||
|
||
for (let i = 0; i < 100; ++i) { | ||
res = await scanImageData(img4); | ||
expect(res).toHaveLength(2); | ||
|
||
inst.malloc(655360); | ||
t2 = getMemoryGrowTimestamp(); | ||
expect(t1).not.toEqual(t2); | ||
t1 = t2; | ||
} | ||
}); |
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,17 @@ | ||
import { getImageData } from './utils'; | ||
import { getMemoryGrowTimestamp } from '../instance'; | ||
import { scanImageData } from '../module'; | ||
|
||
test('Multiple Scan Test', async () => { | ||
const dir = __dirname + '/../../src/test'; | ||
let res; | ||
const img4 = await getImageData(dir + '/test4.png'); | ||
res = await scanImageData(img4); | ||
expect(res).toHaveLength(2); | ||
const memoryGrowTimestamp = getMemoryGrowTimestamp(); | ||
for (let i = 0; i < 100; ++i) { | ||
res = await scanImageData(img4); | ||
expect(res).toHaveLength(2); | ||
expect(getMemoryGrowTimestamp()).toEqual(memoryGrowTimestamp); | ||
} | ||
}); |
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
declare module 'raw-loader!*' { | ||
const content: string; | ||
export default content; | ||
} | ||
declare module '*.bin'; | ||
// declare module '!./zbar.wasm' { | ||
// const content: string; | ||
// export default content; | ||
// } |
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