Skip to content

Commit

Permalink
trying to uploading for wasm file
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenYong committed Apr 16, 2020
1 parent 9c4ac86 commit f128d1a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion example/pages/demo-zxing-wasm-scanner-popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let DemoMixedScannerPopup: FC<{}> = React.memo((props) => {

let popupScanner = usePopupZxingWasmScanner({
errorLocale: "扫码错误: 无法获取相机图像 无法获取相机图像(可能是因为没有 HTTPS 权限)",
zxingWasmPath: "/wasm/zxing-go.wasm",
zxingWasmPath: "wasm/zxing-go.wasm",
onCodeDetected: (code, codeType) => {
console.log(code, codeType);
},
Expand Down
2 changes: 1 addition & 1 deletion example/pages/demo-zxing-wasm-scanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let DemoZxingWasmScanner: FC<{ className?: string }> = React.memo((props) => {
onCodeDetected={(code) => {
console.log("got code", JSON.stringify(code));
}}
zxingWasmPath="/wasm/zxing-go.wasm"
zxingWasmPath="wasm/zxing-go.wasm"
/>
</DocDemo>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/zbar-scanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ let ZbarScanner: FC<{
useEffect(() => {
(async () => {
// let scanner = await Scanner({
// locateFile: (file) => "/wasm/zbar.wasm",
// locateFile: (file) => "wasm/zbar.wasm",
// });
// refScanner.current = scanner;
})();
Expand Down
2 changes: 1 addition & 1 deletion src/zxing-wasm-scanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ let ZxingWasmScanner: FC<{
}

let mod, inst;
WebAssembly.instantiateStreaming(fetch("/wasm/zxing-go.wasm"), go.importObject)
WebAssembly.instantiateStreaming(fetch(props.zxingWasmPath), go.importObject)
.then((result) => {
mod = result.module;
inst = result.instance;
Expand Down
2 changes: 1 addition & 1 deletion webpack/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = {
},
plugins: [
new webpack.DefinePlugin({
GlobalZxingWasmPath: JSON.stringify("/wasm/zxing-go.wasm"),
GlobalZxingWasmPath: JSON.stringify("wasm/zxing-go.wasm"),
}),
new ForkTsCheckerWebpackPlugin({ checkSyntacticErrors: true, async: false }),
new webpack.DllReferencePlugin({
Expand Down
2 changes: 1 addition & 1 deletion webpack/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.exports = {
},
plugins: [
new webpack.DefinePlugin({
GlobalZxingWasmPath: JSON.stringify("/wasm/zxing-go.wasm"),
GlobalZxingWasmPath: JSON.stringify("wasm/zxing-go.wasm"),
}),
new ForkTsCheckerWebpackPlugin({ checkSyntacticErrors: true, async: false }),
new MiniCssExtractPlugin({
Expand Down

0 comments on commit f128d1a

Please sign in to comment.