Skip to content
Merged

Dev #26

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions 1.hello-world/1.hello-world.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<body>
Loading...
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/dbr.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/dbr.js"></script>
<script>
/** LICENSE ALERT - README
* To use the library, you need to first specify a license key using the API "license" as shown below.
Expand All @@ -22,11 +22,11 @@
/**
* 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.
* 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.
* 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.
* 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.
* LICENSE ALERT - THE END
*/

window.onload = async function() {
(async function() {
try {
const scanner = await Dynamsoft.DBR.BarcodeScanner.createInstance();
/**
Expand Down Expand Up @@ -54,9 +54,10 @@
*/
await scanner.show();
} catch (ex) {
alert(ex);
throw ex;
}
};
})();
</script>
</body>

Expand Down
38 changes: 20 additions & 18 deletions 1.hello-world/10.read-video-pwa/helloworld-pwa.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<body>
<h1 style="font-size: 1.5em;">Hello World for PWA</h1>
Loading...
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/dbr.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/dbr.js"></script>
<script>
/** LICENSE ALERT - README
* To use the library, you need to first specify a license key using the API "license" as shown below.
Expand All @@ -24,13 +24,27 @@ <h1 style="font-size: 1.5em;">Hello World for PWA</h1>
/**
* 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.
* 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.
* 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.
* 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.
* LICENSE ALERT - THE END
*/

let pScanner = null;
let latestResult = null;
window.onload = async function() {

function startNotificationLoop() {
if (latestResult != null) {
const title = "New Barcode Found!";
const notifBody = `Barcode Text: ${latestResult}.`;
const options = {
body: notifBody,
};
new Notification(title, options);
latestResult = null;
}
setTimeout(startNotificationLoop, 100);
}

(async function() {
Notification.requestPermission().then((result) => {
if (result === 'granted') {
startNotificationLoop();
Expand All @@ -52,24 +66,12 @@ <h1 style="font-size: 1.5em;">Hello World for PWA</h1>
alert(ex.message);
throw ex;
}
};

function startNotificationLoop() {
if (latestResult != null) {
const title = "New Barcode Found!";
const notifBody = `Barcode Text: ${latestResult}.`;
const options = {
body: notifBody,
};
new Notification(title, options);
latestResult = null;
}
setTimeout(startNotificationLoop, 100);
}
})();

if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./service-worker.js');
};
</script>
</body>

</html>
</html>
12 changes: 6 additions & 6 deletions 1.hello-world/11.read-video-requirejs.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
Loading...
<script src="https://cdn.jsdelivr.net/npm/requirejs@2.3.6/require.js"></script>
<script>
requirejs(['https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/dbr.js'], function({
requirejs(['https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/dbr.js'], function({
BarcodeReader,
BarcodeScanner
}) {
Expand All @@ -26,13 +26,13 @@ <h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
/**
* 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.
* 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.
* 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.
* 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.
* LICENSE ALERT - THE END
*/

BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/";
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/";
let pScanner = null;
window.onload = async function() {
(async function() {
try {
const scanner = await (pScanner = pScanner || BarcodeScanner.createInstance());
scanner.onFrameRead = results => {
Expand All @@ -50,9 +50,9 @@ <h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
alert(ex.message);
throw ex;
}
};
})();
})
</script>
</body>

</html>
</html>
12 changes: 6 additions & 6 deletions 1.hello-world/12.read-video-es6.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<h1 style="font-size: 1.5em;">Hello World for ES6</h1>
Loading...
<script type="module">
import { BarcodeReader, BarcodeScanner } from 'https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/dbr.mjs';
import { BarcodeReader, BarcodeScanner } from 'https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/dbr.mjs';
/** LICENSE ALERT - README
* To use the library, you need to first specify a license key using the API "license" as shown below.
*/
Expand All @@ -23,14 +23,14 @@ <h1 style="font-size: 1.5em;">Hello World for ES6</h1>
/**
* 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.
* 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.
* 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.
* 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.
* LICENSE ALERT - THE END
*/

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

let pScanner = null;
window.onload = async () => {
(async () => {
try {
const scanner = await (pScanner = pScanner || BarcodeScanner.createInstance());
/*
Expand All @@ -57,8 +57,8 @@ <h1 style="font-size: 1.5em;">Hello World for ES6</h1>
alert(ex.message);
throw ex;
}
};
})();
</script>
</body>

</html>
</html>
6 changes: 4 additions & 2 deletions 1.hello-world/2.read-an-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
border: solid 1px gray;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/dbr.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/dbr.js"></script>
<script>
/** LICENSE ALERT - README
* To use the library, you need to first specify a license key using the API "license" as shown below.
Expand All @@ -40,7 +40,7 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
/**
* 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.
* 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.
* 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.
* 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.
* LICENSE ALERT - THE END
*/

Expand All @@ -56,6 +56,7 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
} catch (ex) {
document.getElementById('p-loading').innerText = ex;
document.getElementById('ipt-file').disabled = true;
alert(ex);
throw ex;
}
})();
Expand Down Expand Up @@ -100,6 +101,7 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
divResults.appendChild(document.createElement('hr'));
divResults.scrollTop = divResults.scrollHeight;
} catch (ex) {
alert(ex);
throw ex;
} finally {
pReading.style.display = 'none';
Expand Down
2 changes: 1 addition & 1 deletion 1.hello-world/3.read-video-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@angular/platform-browser": "~11.2.5",
"@angular/platform-browser-dynamic": "~11.2.5",
"@angular/router": "~11.2.5",
"dynamsoft-javascript-barcode": "9.0.0",
"dynamsoft-javascript-barcode": "9.0.1",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.11.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class VideoDecodeComponent implements OnInit {
};
await scanner.open();
} catch (ex) {
console.error(ex);
alert(ex);
}
}
async ngOnDestroy() {
Expand Down
14 changes: 7 additions & 7 deletions 1.hello-world/3.read-video-angular/src/app/dbr.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { BarcodeReader } from 'dynamsoft-javascript-barcode';

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

BarcodeReader.license = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
/**
* 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.

/**
* 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.
* 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.
* 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.
* LICENSE ALERT - THE END
* 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.
* LICENSE ALERT - THE END
*/

BarcodeReader.engineResourcePath = 'https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/';
BarcodeReader.engineResourcePath = 'https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/';
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class ImgDecodeComponent implements OnInit {
}
if(!results.length){ alert('No barcode found'); }
} catch (ex) {
console.error(ex);
alert(ex);
}
e.target.value = '';
}
Expand Down
2 changes: 1 addition & 1 deletion 1.hello-world/4.read-video-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"dynamsoft-javascript-barcode": "9.0.0",
"dynamsoft-javascript-barcode": "9.0.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class ImgDecode extends Component {
}
if(!results.length){ alert('No barcode found'); }
} catch(ex) {
console.error(ex);
alert(ex);
}
e.target.value = '';
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions 1.hello-world/4.read-video-react/src/dbr.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ BarcodeReader.license = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
/**
* 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.
* 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.
* 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.
* 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.
* LICENSE ALERT - THE END
*/

BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/";
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/";
2 changes: 1 addition & 1 deletion 1.hello-world/5.read-video-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"dependencies": {
"core-js": "^3.6.5",
"dynamsoft-javascript-barcode": "9.0.0",
"dynamsoft-javascript-barcode": "9.0.1",
"vue": "2.6.14"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
}
if(!results.length){ alert('No barcode found'); }
} catch(ex) {
console.error(ex);
alert(ex);
}
e.target.value = '';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default {
};
await scanner.open();
} catch (ex) {
console.error(ex);
alert(ex);
}
},
async beforeDestroy() {
Expand Down
4 changes: 2 additions & 2 deletions 1.hello-world/5.read-video-vue/src/dbr.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ BarcodeReader.license = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
/**
* 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.
* 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.
* 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.
* 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.
* LICENSE ALERT - THE END
*/

BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.0/dist/";
BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@9.0.1/dist/";
2 changes: 1 addition & 1 deletion 1.hello-world/6.read-video-vue3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"dependencies": {
"core-js": "^3.6.5",
"dynamsoft-javascript-barcode": "9.0.0",
"dynamsoft-javascript-barcode": "9.0.1",
"vue": "^3.0.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default {
//Load the library on page load to speed things up.
await BarcodeScanner.loadWasm();
} catch (ex) {
console.error(ex);
alert(ex);
}
});
const showScanner = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default {
}
if(!results.length){ alert('No barcode found'); }
} catch(ex) {
console.error(ex);
alert(ex);
}
e.target.value = '';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default {
}
await scanner.open();
} catch (ex) {
console.error(ex);
alert(ex);
}
});
onBeforeUnmount(async () => {
Expand Down
4 changes: 2 additions & 2 deletions 1.hello-world/6.read-video-vue3/src/dbr.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ BarcodeReader.license = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
/**
* 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.
* 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.
* 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.
* 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.
* LICENSE ALERT - THE END
*/

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