You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* To use the library, you need to first specify a license key using the API "license" as shown below.
@@ -22,11 +23,11 @@
22
23
/**
23
24
* 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.
24
25
* 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.
26
+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.2&utm_source=github#specify-the-license or contact support@dynamsoft.com.
errMsg="Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
* To use the library, you need to first specify a license key using the API "license" as shown below.
@@ -24,13 +25,27 @@ <h1 style="font-size: 1.5em;">Hello World for PWA</h1>
24
25
/**
25
26
* 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.
26
27
* 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.
28
+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.2&utm_source=github#specify-the-license or contact support@dynamsoft.com.
28
29
* LICENSE ALERT - THE END
29
30
*/
30
31
31
32
letpScanner=null;
32
33
letlatestResult=null;
33
-
window.onload=asyncfunction(){
34
+
35
+
functionstartNotificationLoop(){
36
+
if(latestResult!=null){
37
+
consttitle="New Barcode Found!";
38
+
constnotifBody=`Barcode Text: ${latestResult}.`;
39
+
constoptions={
40
+
body: notifBody,
41
+
};
42
+
newNotification(title,options);
43
+
latestResult=null;
44
+
}
45
+
setTimeout(startNotificationLoop,100);
46
+
}
47
+
48
+
(asyncfunction(){
34
49
Notification.requestPermission().then((result)=>{
35
50
if(result==='granted'){
36
51
startNotificationLoop();
@@ -49,27 +64,21 @@ <h1 style="font-size: 1.5em;">Hello World for PWA</h1>
errMsg="Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
@@ -26,13 +26,13 @@ <h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
26
26
/**
27
27
* 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.
28
28
* 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.2&utm_source=github#specify-the-license or contact support@dynamsoft.com.
errMsg="Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
* To use the library, you need to first specify a license key using the API "license" as shown below.
19
19
*/
@@ -23,14 +23,14 @@ <h1 style="font-size: 1.5em;">Hello World for ES6</h1>
23
23
/**
24
24
* 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.
25
25
* 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.2&utm_source=github#specify-the-license or contact support@dynamsoft.com.
errMsg="Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
Copy file name to clipboardExpand all lines: 1.hello-world/2.read-an-image.html
+20-5Lines changed: 20 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@
7
7
<metaname="description" content="Read barcodes from images in no time with Dynamsoft Barcode Reader. With this online demo, you can choose a file to scan the barcodes on them.">
8
8
<metaname="keywords" content="read barcode from still images">
9
9
<title>Dynamsoft Barcode Reader Sample - Read an Image</title>
* To use the library, you need to first specify a license key using the API "license" as shown below.
@@ -40,7 +41,7 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
40
41
/**
41
42
* 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.
42
43
* 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.
44
+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.0.2&utm_source=github#specify-the-license or contact support@dynamsoft.com.
44
45
* LICENSE ALERT - THE END
45
46
*/
46
47
@@ -56,7 +57,14 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
errMsg="Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
63
+
}else{
64
+
errMsg=ex.message||ex;
65
+
}
66
+
console.error(errMsg);
67
+
alert(errMsg);
60
68
}
61
69
})();
62
70
@@ -100,7 +108,14 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
errMsg="Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
114
+
}else{
115
+
errMsg=ex.message||ex;
116
+
}
117
+
console.error(errMsg);
118
+
alert(errMsg);
104
119
}finally{
105
120
pReading.style.display='none';
106
121
this.value='';
@@ -122,4 +137,4 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
errMsg="Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
* 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.
11
11
* 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.2&utm_source=github#specify-the-license or contact support@dynamsoft.com.
errMsg="Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
0 commit comments