Skip to content

Commit 9eb6129

Browse files
committed
2 parents 9105e76 + 299134f commit 9eb6129

Some content is hidden

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

52 files changed

+267
-132
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,23 @@
1111

1212
<body>
1313
Loading...
14-
<script src="https://cdn.jsdelivr.net/npm/[email protected].0/dist/dbr.js"></script>
14+
<script src="https://cdn.jsdelivr.net/npm/[email protected].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.
1818
*/
1919

20-
Dynamsoft.DBR.BarcodeReader.license = 'DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAwLWRicl9qc19zYW1wbGVzIiwib3JnYW5pemF0aW9uSUQiOiIyMDAwMDAifQ==';
20+
Dynamsoft.DBR.BarcodeReader.organizationID = "200000";
21+
Dynamsoft.DBR.BarcodeReader.handshakeCode = "200000-dbr_js_samples";
2122

2223
/**
2324
* 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.
2425
* 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 [email protected].
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 [email protected].
2627
* LICENSE ALERT - THE END
2728
*/
2829

29-
window.onload = async function() {
30+
(async function() {
3031
try {
3132
const scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
3233
/**
@@ -54,10 +55,11 @@
5455
*/
5556
await scanner.show();
5657
} catch (ex) {
58+
alert(ex);
5759
throw ex;
5860
}
59-
};
61+
})();
6062
</script>
6163
</body>
6264

63-
</html>
65+
</html>

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

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,39 @@
1313
<body>
1414
<h1 style="font-size: 1.5em;">Hello World for PWA</h1>
1515
Loading...
16-
<script src="https://cdn.jsdelivr.net/npm/[email protected].0/dist/dbr.js"></script>
16+
<script src="https://cdn.jsdelivr.net/npm/[email protected].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.
2020
*/
2121

22-
Dynamsoft.DBR.BarcodeReader.license = 'DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAwLWRicl9qc19zYW1wbGVzIiwib3JnYW5pemF0aW9uSUQiOiIyMDAwMDAifQ==';
22+
Dynamsoft.DBR.BarcodeReader.organizationID = "200000";
23+
Dynamsoft.DBR.BarcodeReader.handshakeCode = "200000-dbr_js_samples";
2324

2425
/**
2526
* 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.
2627
* 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 [email protected].
28+
* 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 [email protected].
2829
* LICENSE ALERT - THE END
2930
*/
3031

3132
let pScanner = null;
3233
let latestResult = null;
33-
window.onload = async function() {
34+
35+
function startNotificationLoop() {
36+
if (latestResult != null) {
37+
const title = "New Barcode Found!";
38+
const notifBody = `Barcode Text: ${latestResult}.`;
39+
const options = {
40+
body: notifBody,
41+
};
42+
new Notification(title, options);
43+
latestResult = null;
44+
}
45+
setTimeout(startNotificationLoop, 100);
46+
}
47+
48+
(async function() {
3449
Notification.requestPermission().then((result) => {
3550
if (result === 'granted') {
3651
startNotificationLoop();
@@ -52,24 +67,12 @@ <h1 style="font-size: 1.5em;">Hello World for PWA</h1>
5267
alert(ex.message);
5368
throw ex;
5469
}
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-
}
70+
})();
71+
6972
if ('serviceWorker' in navigator) {
7073
navigator.serviceWorker.register('./service-worker.js');
7174
};
7275
</script>
7376
</body>
7477

75-
</html>
78+
</html>

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,27 @@ <h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
1313
Loading...
1414
<script src="https://cdn.jsdelivr.net/npm/[email protected]/require.js"></script>
1515
<script>
16-
requirejs(['https://cdn.jsdelivr.net/npm/[email protected].0/dist/dbr.js'], function({
16+
requirejs(['https://cdn.jsdelivr.net/npm/[email protected].1/dist/dbr.js'], function({
1717
BarcodeReader,
1818
BarcodeScanner
1919
}) {
2020
/** LICENSE ALERT - README
2121
* To use the library, you need to first specify a license key using the API "license" as shown below.
2222
*/
2323

24-
BarcodeReader.license = 'DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAwLWRicl9qc19zYW1wbGVzIiwib3JnYW5pemF0aW9uSUQiOiIyMDAwMDAifQ==';
24+
BarcodeReader.organizationID = "200000";
25+
BarcodeReader.handshakeCode = "200000-dbr_js_samples";
2526

2627
/**
2728
* 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.
2829
* 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 [email protected].
30+
* 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 [email protected].
3031
* LICENSE ALERT - THE END
3132
*/
3233

33-
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/[email protected].0/dist/";
34+
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/[email protected].1/dist/";
3435
let pScanner = null;
35-
window.onload = async function() {
36+
(async function() {
3637
try {
3738
const scanner = await (pScanner = pScanner || BarcodeScanner.createInstance());
3839
scanner.onFrameRead = results => {
@@ -50,9 +51,9 @@ <h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
5051
alert(ex.message);
5152
throw ex;
5253
}
53-
};
54+
})();
5455
})
5556
</script>
5657
</body>
5758

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

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,25 @@
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/[email protected].0/dist/dbr.mjs';
16+
import { BarcodeReader, BarcodeScanner } from 'https://cdn.jsdelivr.net/npm/[email protected].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
*/
2020

21-
BarcodeReader.license = 'DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAwLWRicl9qc19zYW1wbGVzIiwib3JnYW5pemF0aW9uSUQiOiIyMDAwMDAifQ==';
21+
BarcodeReader.organizationID = "200000";
22+
BarcodeReader.handshakeCode = "200000-dbr_js_samples";
2223

2324
/**
2425
* 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.
2526
* 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 [email protected].
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 [email protected].
2728
* LICENSE ALERT - THE END
2829
*/
2930

30-
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/[email protected].0/dist/";
31+
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/[email protected].1/dist/";
3132

3233
let pScanner = null;
33-
window.onload = async () => {
34+
(async () => {
3435
try {
3536
const scanner = await (pScanner = pScanner || BarcodeScanner.createInstance());
3637
/*
@@ -57,8 +58,8 @@ <h1 style="font-size: 1.5em;">Hello World for ES6</h1>
5758
alert(ex.message);
5859
throw ex;
5960
}
60-
};
61+
})();
6162
</script>
6263
</body>
6364

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

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,19 @@ <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/[email protected].0/dist/dbr.js"></script>
32+
<script src="https://cdn.jsdelivr.net/npm/[email protected].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.
3636
*/
3737

38-
Dynamsoft.DBR.BarcodeReader.license = 'DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAwLWRicl9qc19zYW1wbGVzIiwib3JnYW5pemF0aW9uSUQiOiIyMDAwMDAifQ==';
38+
Dynamsoft.DBR.BarcodeReader.organizationID = "200000";
39+
Dynamsoft.DBR.BarcodeReader.handshakeCode = "200000-dbr_js_samples";
3940

4041
/**
4142
* 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.
4243
* 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 [email protected].
44+
* 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 [email protected].
4445
* LICENSE ALERT - THE END
4546
*/
4647

@@ -56,6 +57,7 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
5657
} catch (ex) {
5758
document.getElementById('p-loading').innerText = ex;
5859
document.getElementById('ipt-file').disabled = true;
60+
alert(ex);
5961
throw ex;
6062
}
6163
})();
@@ -100,6 +102,7 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
100102
divResults.appendChild(document.createElement('hr'));
101103
divResults.scrollTop = divResults.scrollHeight;
102104
} catch (ex) {
105+
alert(ex);
103106
throw ex;
104107
} finally {
105108
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() {

1.hello-world/3.read-video-angular/src/app/dbr.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ import { BarcodeReader } from 'dynamsoft-javascript-barcode';
44
* To use the library, you need to first specify a license key using the API "license" as shown below.
55
*/
66

7-
BarcodeReader.license = 'DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAwLWRicl9qc19zYW1wbGVzIiwib3JnYW5pemF0aW9uSUQiOiIyMDAwMDAifQ==';
7+
BarcodeReader.organizationID = "200000";
8+
BarcodeReader.handshakeCode = "200000-dbr_js_samples";
89

910
/**
1011
* 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.
1112
* 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 [email protected].
13+
* 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 [email protected].
1314
* LICENSE ALERT - THE END
1415
*/
1516

16-
BarcodeReader.engineResourcePath = 'https://cdn.jsdelivr.net/npm/[email protected].0/dist/';
17+
BarcodeReader.engineResourcePath = 'https://cdn.jsdelivr.net/npm/[email protected].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)