|
1 | 1 | # The Hello World Sample Set |
2 | 2 |
|
3 | | -As you have gone through the [user guide](https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=latest#getting-started---hello-world), you might have seen some basic "Hello World" code to help you quickly create a basic web application that uses our SDK. |
| 3 | +As you have already gone through the [user guide](https://www.dynamsoft.com/barcode-reader/programming/javascript/user-guide/?ver=latest#getting-started---hello-world), you may have come across some basic "Hello World" code that can help you create a simple web application using our SDK quickly. |
4 | 4 |
|
5 | | -This sample set will revisit the Hello World code, and its implementation in some of the popular frameworks such as Angular, React, an Vue. |
| 5 | +In this set of samples, we will revisit the "Hello World" code and show how to implement it using some popular frameworks, such as Angular, React, and Vue. |
6 | 6 |
|
7 | | -Let's break down each of the samples |
| 7 | +Let's now go through each of the samples. |
8 | 8 |
|
9 | 9 | ## Hello World - Read Barcodes via Video |
10 | 10 |
|
11 | | -In this sample, you will find the basic lines of code necessary to initialize the SDK and set it up. |
| 11 | +In this example, you will learn the minimum codes required to initialize and set up the SDK. |
12 | 12 |
|
13 | 13 | Let's quickly break down the methods used in order: |
14 | 14 |
|
15 | | -* `license`: This property specifies a license key. Read more on Specify the license. |
| 15 | +* `license`: This property specifies a license key. |
16 | 16 | * `createInstance()`: This method creates a `BarcodeScanner` object. This object can read barcodes directly from a video input with the help of its interactive UI (hidden by default) and the MediaDevices interface. |
17 | 17 | * `onFrameRead`: This event is triggered every time the SDK finishes scanning a video frame. The `results` object contains all the barcode results that the SDK have found on this frame. In this example, we print the results to the browser console. |
18 | | -* `onUniqueRead`: This event is triggered when the SDK finds a new barcode, which is not a duplicate among multiple frames. `txt` holds the barcode text value while `result` is an object that holds details of the barcode. In this example, an alert will be displayed for this new barcode. |
| 18 | +* `onUniqueRead`: This event is triggered when the SDK finds a new barcode, which is unique among multiple frames. `txt` holds the barcode text value while `result` is an object that holds details of the barcode. In this example, an alert will be displayed on unique reads. |
19 | 19 | * `show()`: This method brings up the built-in UI of the `BarcodeScanner` object and starts scanning |
20 | 20 |
|
21 | | -In fact, `onFrameRead` and `onUniqueRead` do not have to both be defined in the code. `onUniqueRead` is the more used one between the two as it is triggered when a new barcode is found rather than on every frame. |
| 21 | +Actually, it is not necessary to define both onFrameRead and onUniqueRead in the code. onUniqueRead is more commonly used because it is triggered only when a new barcode is detected, rather than on every frame. |
22 | 22 |
|
23 | 23 | ## Hello World - Read Barcodes from an Image |
24 | 24 |
|
25 | | -The second sample in this set focuses on the secondary class `BarcodeReader` which is a low-level barcode reader that processes still images and returns barcode results. |
| 25 | +The second sample in this set focuses on the secondary class `BarcodeReader` which is a low-level barcode reader that processes static images and returns barcode results. |
26 | 26 |
|
27 | | -In this sample, a event listener is set up so that the SDK decodes any image that the user uploads. |
| 27 | +In this sample, an event listener is set up so that the SDK decodes any images that the user uploads. |
28 | 28 |
|
29 | | -[`decode`](https://www.dynamsoft.com/barcode-reader/programming/javascript/api-reference/BarcodeReader.html?ver=latest#decode) is the main method to go for when using the `BarcodeReader` class, although the class offers a number of other methods should you work with base64 strings, for instance. The rest of the image decoding methods can be found [here](https://www.dynamsoft.com/barcode-reader/programming/javascript/api-reference/BarcodeReader.html?ver=latest#decode-barcodes). |
| 29 | +When working with the BarcodeReader class, the main method to use is [`decode`](https://www.dynamsoft.com/barcode-reader/programming/javascript/api-reference/BarcodeReader.html?ver=latest#decode), although the class provides several other methods if you need to work with base64 strings or other formats. You can find the rest of the image decoding methods [here](https://www.dynamsoft.com/barcode-reader/programming/javascript/api-reference/BarcodeReader.html?ver=latest#decode-barcodes). |
30 | 30 |
|
31 | 31 | ## Hello World in Angular |
32 | 32 |
|
@@ -70,27 +70,27 @@ This sample shows how to use the SDK in a web page based on RequireJS. |
70 | 70 |
|
71 | 71 | Let's quickly break down the methods used in order: |
72 | 72 |
|
73 | | -* `license`: This property specifies a license key. Read more on Specify the license. |
| 73 | +* `license`: This property specifies a license key. |
74 | 74 | * `createInstance()`: This method creates a `BarcodeScanner` object. This object can read barcodes directly from a video input with the help of its interactive UI (hidden by default) and the MediaDevices interface. |
75 | 75 | * `onFrameRead`: This event is triggered every time the SDK finishes scanning a video frame. The `results` object contains all the barcode results that the SDK have found on this frame. In this example, we print the results to the browser console. |
76 | | -* `onUniqueRead`: This event is triggered when the SDK finds a new barcode, which is not a duplicate among multiple frames. `txt` holds the barcode text value while `result` is an object that holds details of the barcode. In this example, an alert will be displayed for this new barcode. |
| 76 | +* `onUniqueRead`: This event is triggered when the SDK finds a new barcode, which is unique among multiple frames. `txt` holds the barcode text value while `result` is an object that holds details of the barcode. In this example, an alert will be displayed on unique reads. |
77 | 77 | * `show()`: This method brings up the built-in UI of the `BarcodeScanner` object and starts scanning |
78 | 78 |
|
79 | | -In fact, `onFrameRead` and `onUniqueRead` do not have to both be defined in the code. `onUniqueRead` is the more used one between the two as it is triggered when a new barcode is found rather than on every frame. |
| 79 | +Actually, it is not necessary to define both onFrameRead and onUniqueRead in the code. onUniqueRead is more commonly used because it is triggered only when a new barcode is detected, rather than on every frame. |
80 | 80 |
|
81 | 81 | ## Hello World with ES6 |
82 | 82 |
|
83 | 83 | This sample shows how to use the SDK in a web page based on ES6 (also known as ECMAScript 2015 or ECMAScript 6). |
84 | 84 |
|
85 | 85 | Let's quickly break down the methods used in order: |
86 | 86 |
|
87 | | -* `license`: This property specifies a license key. Read more on Specify the license. |
| 87 | +* `license`: This property specifies a license key. |
88 | 88 | * `createInstance()`: This method creates a `BarcodeScanner` object. This object can read barcodes directly from a video input with the help of its interactive UI (hidden by default) and the MediaDevices interface. |
89 | 89 | * `onFrameRead`: This event is triggered every time the SDK finishes scanning a video frame. The `results` object contains all the barcode results that the SDK have found on this frame. In this example, we print the results to the browser console. |
90 | | -* `onUniqueRead`: This event is triggered when the SDK finds a new barcode, which is not a duplicate among multiple frames. `txt` holds the barcode text value while `result` is an object that holds details of the barcode. In this example, an alert will be displayed for this new barcode. |
| 90 | +* `onUniqueRead`: This event is triggered when the SDK finds a new barcode, which is unique among multiple frames. `txt` holds the barcode text value while `result` is an object that holds details of the barcode. In this example, an alert will be displayed on unique reads. |
91 | 91 | * `show()`: This method brings up the built-in UI of the `BarcodeScanner` object and starts scanning |
92 | 92 |
|
93 | | -In fact, `onFrameRead` and `onUniqueRead` do not have to both be defined in the code. `onUniqueRead` is the more used one between the two as it is triggered when a new barcode is found rather than on every frame. |
| 93 | +Actually, it is not necessary to define both onFrameRead and onUniqueRead in the code. onUniqueRead is more commonly used because it is triggered only when a new barcode is detected, rather than on every frame. |
94 | 94 |
|
95 | 95 | ## Hello World with WebView |
96 | 96 |
|
|
0 commit comments