Skip to content

Commit 7025031

Browse files
authored
Merge pull request #10 from Dynamsoft/_dev
Dev
2 parents b7a7634 + ec765ef commit 7025031

File tree

30 files changed

+112
-110
lines changed

30 files changed

+112
-110
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
<meta name="description" content="Quickly read barcodes with Dynamsoft Barcode Reader from a live camera stream.">
88
<meta name="keywords" content="camera based barcode reading">
99
<title>Dynamsoft Barcode Reader Sample - Hello World (Decoding via Camera)</title>
10-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.8.7/dist/dbr.js"></script>
1110
</head>
1211

1312
<body>
1413
<h1 style="font-size: 1.5em;">Read Barcodes from a Camera</h1>
1514
<button id="btn-show-scanner">Show Barcode Scanner</button>
15+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.8.7/dist/dbr.js"></script>
1616
<script>
1717
/** LICENSE ALERT - README
1818
*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
<meta name="description" content="Read barcodes from camera with Dynamsoft Barcode Reader in a PWA application.">
88
<meta name="keywords" content="read barcode from camera in PWA">
99
<title>Dynamsoft Barcode Reader PWA Sample - Hello World (Decoding via Camera)</title>
10-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.8.7/dist/dbr.js"></script>
1110
<link rel="manifest" href="./helloworld-pwa.json">
1211
</head>
1312

1413
<body>
1514
<h1 style="font-size: 1.5em;">Hello World for PWA</h1>
1615
<button id='readBarcode'>Read Barcode via Camera</button>
16+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.8.7/dist/dbr.js"></script>
1717
<script>
1818
/** LICENSE ALERT - README
1919
*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<meta name="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.">
88
<meta name="keywords" content="read barcode from still images">
99
<title>Dynamsoft Barcode Reader Sample - Read an Image</title>
10-
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.8.7/dist/dbr.js"></script>
1110
</head>
1211

1312
<body>
@@ -25,6 +24,7 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
2524
.sp-resultText { color: #cE5E04 }
2625
#div-cvs-container canvas { border: solid 1px gray; }
2726
</style>
27+
<script src="https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.8.7/dist/dbr.js"></script>
2828
<script>
2929
/** LICENSE ALERT - README
3030
*

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, OnInit } from '@angular/core';
2-
import DBR from '../dbr';
2+
import { BarcodeScanner } from 'dynamsoft-javascript-barcode'
33
@Component({
44
selector: 'app-video-decode',
55
templateUrl: './barcode-scanner.component.html',
@@ -10,7 +10,7 @@ export class VideoDecodeComponent implements OnInit {
1010

1111
async ngOnInit(): Promise<void> {
1212
try {
13-
const scanner = await (this.pScanner = DBR.BarcodeScanner.createInstance());
13+
const scanner = await (this.pScanner = BarcodeScanner.createInstance());
1414
scanner.setUIElement((document.querySelector('.component-barcode-scanner') as any));
1515
scanner.onFrameRead = (results: any) => {
1616
for (const result of results) {

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import DBR from "dynamsoft-javascript-barcode";
1+
import { BarcodeReader } from 'dynamsoft-javascript-barcode';
22

33
/** LICENSE ALERT - README
44
*
@@ -14,6 +14,4 @@ import DBR from "dynamsoft-javascript-barcode";
1414

1515
/** LICENSE ALERT - THE END */
1616

17-
DBR.BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.8.7/dist/";
18-
19-
export default DBR;
17+
BarcodeReader.engineResourcePath = 'https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.8.7/dist/';

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component, OnInit } from '@angular/core';
2-
import DBR from '../dbr';
2+
import '../dbr'; // import side effects. The license, engineResourcePath, so on.
3+
import { BarcodeScanner } from 'dynamsoft-javascript-barcode';
34

45
@Component({
56
selector: 'app-hello-world',
@@ -12,7 +13,7 @@ export class HelloWorldComponent implements OnInit {
1213
async ngOnInit(): Promise<void> {
1314
// Load the library on page load to speed things up.
1415
try {
15-
await DBR.BarcodeScanner.loadWasm();
16+
await BarcodeScanner.loadWasm();
1617
} catch (ex) {
1718
alert(ex.message);
1819
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, OnInit } from '@angular/core';
2-
import DBR from '../dbr';
2+
import {BarcodeReader} from 'dynamsoft-javascript-barcode'
33

44
@Component({
55
selector: 'app-img-decode',
@@ -13,7 +13,7 @@ export class ImgDecodeComponent implements OnInit {
1313

1414
decodeImg = async (e: any) => {
1515
try {
16-
const reader = await (this.pReader = DBR.BarcodeReader.createInstance());
16+
const reader = await (this.pReader = BarcodeReader.createInstance());
1717
const results = await reader.decode(e.target.files[0]);
1818
for (const result of results) {
1919
alert(result.barcodeText);

1.hello-world/4.read-video-react/src/components/HelloWorld/HelloWorld.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import './HelloWorld.css';
22
import reactLogo from '../../logo.svg';
3-
import DBR from "../../dbr";
3+
import "../../dbr"; // import side effects. The license, engineResourcePath, so on.
4+
import { BarcodeReader } from "dynamsoft-javascript-barcode";
45
import React from 'react';
56
import VideoDecode from '../VideoDecode/VideoDecode';
67
import ImgDecode from '../ImgDecode/ImgDecode';
@@ -15,7 +16,7 @@ class HelloWorld extends React.Component {
1516
}
1617
async componentDidMount() {
1718
try {
18-
await DBR.BarcodeScanner.loadWasm();
19+
await BarcodeReader.loadWasm();
1920
} catch (ex) {
2021
alert(ex.message);
2122
throw ex;

1.hello-world/4.read-video-react/src/components/ImgDecode/ImgDecode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from 'react'
2-
import DBR from "../../dbr";
2+
import { BarcodeReader } from "dynamsoft-javascript-barcode";
33
import './ImgDecode.css'
44

55
export default class ImgDecode extends Component {
@@ -10,7 +10,7 @@ export default class ImgDecode extends Component {
1010

1111
decodeImg = async (e) => {
1212
try {
13-
const reader = await (this.pReader = DBR.BarcodeReader.createInstance());
13+
const reader = await (this.pReader = BarcodeReader.createInstance());
1414
let results = await reader.decode(e.target.files[0]);
1515
for(let result of results){
1616
alert(result.barcodeText);

1.hello-world/4.read-video-react/src/components/VideoDecode/VideoDecode.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)