Skip to content

Commit ac4fe07

Browse files
committed
Merge branch '_dev' into amro-branch
2 parents 4a70b9c + 0e875e1 commit ac4fe07

Some content is hidden

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

43 files changed

+121
-80
lines changed

1.hello-world/1.minimum-code.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<body>
1414
Loading...
15-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.0/dist/dbr.js"></script>
15+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.1/dist/dbr.js"></script>
1616
<script>
1717
/** LICENSE ALERT - README
1818
* To use the library, you need to first specify a license key using the API "license" as shown below.
@@ -23,7 +23,7 @@
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.6.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.6.1&utm_source=github#specify-the-license or contact support@dynamsoft.com.
2727
* LICENSE ALERT - THE END
2828
*/
2929

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<body>
1515
<h1 style="font-size: 1.5em;">Hello World for PWA</h1>
1616
Loading...
17-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.0/dist/dbr.js"></script>
17+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.1/dist/dbr.js"></script>
1818
<script>
1919
/** LICENSE ALERT - README
2020
* To use the library, you need to first specify a license key using the API "license" as shown below.
@@ -25,7 +25,7 @@ <h1 style="font-size: 1.5em;">Hello World for PWA</h1>
2525
/**
2626
* 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.
2727
* 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.
28-
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.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.6.1&utm_source=github#specify-the-license or contact support@dynamsoft.com.
2929
* LICENSE ALERT - THE END
3030
*/
3131

@@ -46,11 +46,13 @@ <h1 style="font-size: 1.5em;">Hello World for PWA</h1>
4646
}
4747

4848
(async function() {
49-
Notification.requestPermission().then((result) => {
50-
if (result === 'granted') {
51-
startNotificationLoop();
52-
}
53-
});
49+
if(window.Notification) {
50+
Notification.requestPermission().then((result) => {
51+
if (result === 'granted') {
52+
startNotificationLoop();
53+
}
54+
});
55+
}
5456
try {
5557
const scanner = await (pScanner = pScanner || Dynamsoft.DBR.BarcodeScanner.createInstance());
5658
scanner.onFrameRead = results => {

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

Lines changed: 3 additions & 3 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.6.0/dist/dbr.js'], function({
16+
requirejs(['https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.1/dist/dbr.js'], function({
1717
BarcodeReader,
1818
BarcodeScanner
1919
}) {
@@ -26,11 +26,11 @@ <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.6.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.6.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.6.0/dist/";
33+
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.1/dist/";
3434
let pScanner = null;
3535
(async function() {
3636
try {

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

Lines changed: 3 additions & 3 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.6.0/dist/dbr.mjs';
16+
import { BarcodeReader, BarcodeScanner } from 'https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.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,11 +23,11 @@ <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.6.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.6.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.6.0/dist/";
30+
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.1/dist/";
3131

3232
let pScanner = null;
3333
(async () => {

1.hello-world/13.read-video-react-ts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@types/node": "^16.11.45",
1212
"@types/react": "^18.0.15",
1313
"@types/react-dom": "^18.0.6",
14-
"dynamsoft-javascript-barcode": "9.6.0",
14+
"dynamsoft-javascript-barcode": "9.6.1",
1515
"react": "^18.2.0",
1616
"react-dom": "^18.2.0",
1717
"react-scripts": "5.0.1",

1.hello-world/13.read-video-react-ts/src/components/VideoDecode/VideoDecode.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ import React from 'react';
33
import './VideoDecode.css'
44

55
class VideoDecode extends React.Component {
6-
pScanner: Promise<BarcodeScanner> = BarcodeScanner.createInstance();
6+
pScanner: Promise<BarcodeScanner>|null = null;
77
elRef: React.RefObject<HTMLDivElement> = React.createRef();
88
async componentDidMount() {
99
try {
10-
const scanner = await this.pScanner;
10+
const scanner = await (this.pScanner = BarcodeScanner.createInstance());
11+
// Should judge if scanner is destroyed after 'await' in React 18 'StrictMode'.
12+
if(scanner.isContextDestroyed()) return;
1113
await scanner.setUIElement(this.elRef.current!);
14+
// Should judge if scanner is destroyed after 'await' in React 18 'StrictMode'.
15+
if(scanner.isContextDestroyed()) return;
1216
scanner.onFrameRead = results => {
1317
for (let result of results) {
1418
console.log(result.barcodeText);

1.hello-world/13.read-video-react-ts/src/dbr.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ BarcodeReader.license = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
99
/**
1010
* 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.6.0&utm_source=github#specify-the-license or contact support@dynamsoft.com.
12+
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.1&utm_source=github#specify-the-license or contact support@dynamsoft.com.
1313
* LICENSE ALERT - THE END
1414
*/
1515

16-
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.0/dist/";
16+
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.1/dist/";

1.hello-world/13.read-video-react-ts/src/index.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,18 @@ import React from 'react';
22
import ReactDOM from 'react-dom/client';
33
import './index.css';
44
import App from './App';
5+
import reportWebVitals from './reportWebVitals';
56

6-
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
7+
const root = ReactDOM.createRoot(
8+
document.getElementById('root') as HTMLElement
9+
);
10+
root.render(
11+
<React.StrictMode>
12+
<App />
13+
</React.StrictMode>
14+
);
715

8-
root.render(<App />);
16+
// If you want to start measuring performance in your app, pass a function
17+
// to log results (for example: reportWebVitals(console.log))
18+
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
19+
reportWebVitals();
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { ReportHandler } from 'web-vitals';
2+
3+
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
4+
if (onPerfEntry && onPerfEntry instanceof Function) {
5+
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
6+
getCLS(onPerfEntry);
7+
getFID(onPerfEntry);
8+
getFCP(onPerfEntry);
9+
getLCP(onPerfEntry);
10+
getTTFB(onPerfEntry);
11+
});
12+
}
13+
};
14+
15+
export default reportWebVitals;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
3030
border: solid 1px gray;
3131
}
3232
</style>
33-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.0/dist/dbr.js"></script>
33+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.6.1/dist/dbr.js"></script>
3434
<script>
3535
/** LICENSE ALERT - README
3636
* To use the library, you need to first specify a license key using the API "license" as shown below.
@@ -41,7 +41,7 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
4141
/**
4242
* 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.
4343
* 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.
44-
* For more information, see https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=9.6.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.6.1&utm_source=github#specify-the-license or contact support@dynamsoft.com.
4545
* LICENSE ALERT - THE END
4646
*/
4747

0 commit comments

Comments
 (0)