Skip to content

Commit e761ddd

Browse files
authored
Merge pull request #26 from Dynamsoft/_dev
Dev
2 parents 568c2b4 + 49a8134 commit e761ddd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+129
-110
lines changed

1.hello-world/1.hello-world.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<body>
1313
Loading...
14-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/dbr.js"></script>
14+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/dbr.js"></script>
1515
<script>
1616
/** LICENSE ALERT - README
1717
* To use the library, you need to first specify a license key using the API "license" as shown below.
@@ -22,11 +22,11 @@
2222
/**
2323
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
2424
* Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license.
25-
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.0&utm_source=github#specify-the-license or contact support@dynamsoft.com.
25+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.1&utm_source=github#specify-the-license or contact support@dynamsoft.com.
2626
* LICENSE ALERT - THE END
2727
*/
2828

29-
window.onload = async function() {
29+
(async function() {
3030
try {
3131
const scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
3232
/**
@@ -54,9 +54,10 @@
5454
*/
5555
await scanner.show();
5656
} catch (ex) {
57+
alert(ex);
5758
throw ex;
5859
}
59-
};
60+
})();
6061
</script>
6162
</body>
6263

1.hello-world/10.read-video-pwa/helloworld-pwa.html

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<body>
1414
<h1 style="font-size: 1.5em;">Hello World for PWA</h1>
1515
Loading...
16-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/dbr.js"></script>
16+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/dbr.js"></script>
1717
<script>
1818
/** LICENSE ALERT - README
1919
* To use the library, you need to first specify a license key using the API "license" as shown below.
@@ -24,13 +24,27 @@ <h1 style="font-size: 1.5em;">Hello World for PWA</h1>
2424
/**
2525
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
2626
* Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license.
27-
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.0&utm_source=github#specify-the-license or contact support@dynamsoft.com.
27+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.1&utm_source=github#specify-the-license or contact support@dynamsoft.com.
2828
* LICENSE ALERT - THE END
2929
*/
3030

3131
let pScanner = null;
3232
let latestResult = null;
33-
window.onload = async function() {
33+
34+
function startNotificationLoop() {
35+
if (latestResult != null) {
36+
const title = "New Barcode Found!";
37+
const notifBody = `Barcode Text: ${latestResult}.`;
38+
const options = {
39+
body: notifBody,
40+
};
41+
new Notification(title, options);
42+
latestResult = null;
43+
}
44+
setTimeout(startNotificationLoop, 100);
45+
}
46+
47+
(async function() {
3448
Notification.requestPermission().then((result) => {
3549
if (result === 'granted') {
3650
startNotificationLoop();
@@ -52,24 +66,12 @@ <h1 style="font-size: 1.5em;">Hello World for PWA</h1>
5266
alert(ex.message);
5367
throw ex;
5468
}
55-
};
56-
57-
function startNotificationLoop() {
58-
if (latestResult != null) {
59-
const title = "New Barcode Found!";
60-
const notifBody = `Barcode Text: ${latestResult}.`;
61-
const options = {
62-
body: notifBody,
63-
};
64-
new Notification(title, options);
65-
latestResult = null;
66-
}
67-
setTimeout(startNotificationLoop, 100);
68-
}
69+
})();
70+
6971
if ('serviceWorker' in navigator) {
7072
navigator.serviceWorker.register('./service-worker.js');
7173
};
7274
</script>
7375
</body>
7476

75-
</html>
77+
</html>

1.hello-world/11.read-video-requirejs.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ <h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
1313
Loading...
1414
<script src="https://cdn.jsdelivr.net/npm/requirejs@2.3.6/require.js"></script>
1515
<script>
16-
requirejs(['https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/dbr.js'], function({
16+
requirejs(['https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/dbr.js'], function({
1717
BarcodeReader,
1818
BarcodeScanner
1919
}) {
@@ -26,13 +26,13 @@ <h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
2626
/**
2727
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
2828
* Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license.
29-
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.0&utm_source=github#specify-the-license or contact support@dynamsoft.com.
29+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.1&utm_source=github#specify-the-license or contact support@dynamsoft.com.
3030
* LICENSE ALERT - THE END
3131
*/
3232

33-
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/";
33+
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/";
3434
let pScanner = null;
35-
window.onload = async function() {
35+
(async function() {
3636
try {
3737
const scanner = await (pScanner = pScanner || BarcodeScanner.createInstance());
3838
scanner.onFrameRead = results => {
@@ -50,9 +50,9 @@ <h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
5050
alert(ex.message);
5151
throw ex;
5252
}
53-
};
53+
})();
5454
})
5555
</script>
5656
</body>
5757

58-
</html>
58+
</html>

1.hello-world/12.read-video-es6.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<h1 style="font-size: 1.5em;">Hello World for ES6</h1>
1414
Loading...
1515
<script type="module">
16-
import { BarcodeReader, BarcodeScanner } from 'https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/dbr.mjs';
16+
import { BarcodeReader, BarcodeScanner } from 'https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/dbr.mjs';
1717
/** LICENSE ALERT - README
1818
* To use the library, you need to first specify a license key using the API "license" as shown below.
1919
*/
@@ -23,14 +23,14 @@ <h1 style="font-size: 1.5em;">Hello World for ES6</h1>
2323
/**
2424
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
2525
* Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license.
26-
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.0&utm_source=github#specify-the-license or contact support@dynamsoft.com.
26+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.1&utm_source=github#specify-the-license or contact support@dynamsoft.com.
2727
* LICENSE ALERT - THE END
2828
*/
2929

30-
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/";
30+
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/";
3131

3232
let pScanner = null;
33-
window.onload = async () => {
33+
(async () => {
3434
try {
3535
const scanner = await (pScanner = pScanner || BarcodeScanner.createInstance());
3636
/*
@@ -57,8 +57,8 @@ <h1 style="font-size: 1.5em;">Hello World for ES6</h1>
5757
alert(ex.message);
5858
throw ex;
5959
}
60-
};
60+
})();
6161
</script>
6262
</body>
6363

64-
</html>
64+
</html>

1.hello-world/2.read-an-image.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
2929
border: solid 1px gray;
3030
}
3131
</style>
32-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/dbr.js"></script>
32+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/dbr.js"></script>
3333
<script>
3434
/** LICENSE ALERT - README
3535
* To use the library, you need to first specify a license key using the API "license" as shown below.
@@ -40,7 +40,7 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
4040
/**
4141
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
4242
* Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license.
43-
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.0&utm_source=github#specify-the-license or contact support@dynamsoft.com.
43+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.1&utm_source=github#specify-the-license or contact support@dynamsoft.com.
4444
* LICENSE ALERT - THE END
4545
*/
4646

@@ -56,6 +56,7 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
5656
} catch (ex) {
5757
document.getElementById('p-loading').innerText = ex;
5858
document.getElementById('ipt-file').disabled = true;
59+
alert(ex);
5960
throw ex;
6061
}
6162
})();
@@ -100,6 +101,7 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
100101
divResults.appendChild(document.createElement('hr'));
101102
divResults.scrollTop = divResults.scrollHeight;
102103
} catch (ex) {
104+
alert(ex);
103105
throw ex;
104106
} finally {
105107
pReading.style.display = 'none';

1.hello-world/3.read-video-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@angular/platform-browser": "~11.2.5",
2020
"@angular/platform-browser-dynamic": "~11.2.5",
2121
"@angular/router": "~11.2.5",
22-
"dynamsoft-javascript-barcode": "9.0.0",
22+
"dynamsoft-javascript-barcode": "9.0.1",
2323
"rxjs": "~6.6.0",
2424
"tslib": "^2.0.0",
2525
"zone.js": "~0.11.3"

1.hello-world/3.read-video-angular/src/app/barcode-scanner/barcode-scanner.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class VideoDecodeComponent implements OnInit {
2222
};
2323
await scanner.open();
2424
} catch (ex) {
25-
console.error(ex);
25+
alert(ex);
2626
}
2727
}
2828
async ngOnDestroy() {
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { BarcodeReader } from 'dynamsoft-javascript-barcode';
22

3-
/** LICENSE ALERT - README
3+
/** LICENSE ALERT - README
44
* To use the library, you need to first specify a license key using the API "license" as shown below.
55
*/
66

77
BarcodeReader.license = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
8-
9-
/**
10-
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
8+
9+
/**
10+
* You can visit https://www.dynamsoft.com/customer/license/trialLicense?utm_source=github&product=dbr&package=js to get your own trial license good for 30 days.
1111
* Note that if you downloaded this sample from Dynamsoft while logged in, the above license key may already be your own 30-day trial license.
12-
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.0&utm_source=github#specify-the-license or contact support@dynamsoft.com.
13-
* LICENSE ALERT - THE END
12+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.1&utm_source=github#specify-the-license or contact support@dynamsoft.com.
13+
* LICENSE ALERT - THE END
1414
*/
1515

16-
BarcodeReader.engineResourcePath = 'https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/';
16+
BarcodeReader.engineResourcePath = 'https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/';

1.hello-world/3.read-video-angular/src/app/img-decode/img-decode.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class ImgDecodeComponent implements OnInit {
2020
}
2121
if(!results.length){ alert('No barcode found'); }
2222
} catch (ex) {
23-
console.error(ex);
23+
alert(ex);
2424
}
2525
e.target.value = '';
2626
}

1.hello-world/4.read-video-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"@testing-library/jest-dom": "^5.11.4",
88
"@testing-library/react": "^11.1.0",
99
"@testing-library/user-event": "^12.1.10",
10-
"dynamsoft-javascript-barcode": "9.0.0",
10+
"dynamsoft-javascript-barcode": "9.0.1",
1111
"react": "^17.0.1",
1212
"react-dom": "^17.0.1",
1313
"react-scripts": "4.0.3",

0 commit comments

Comments
 (0)