Skip to content

Commit

Permalink
js-wasm browser example: Replace all instances of "{GS}", not just first
Browse files Browse the repository at this point in the history
  • Loading branch information
terryburton committed Jul 16, 2024
1 parent 9071a57 commit 9d929a6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/demo/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Example HTML app that uses the JS + WASM build of the GS1 Syntax Engine.
Copyright (c) 2022 GS1 AISBL.
Copyright (c) 2022-2024 GS1 AISBL.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions docs/demo/example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Event-driven functions for example HTML app. which uses the JavaScript
* wrapper around the WASM build of the GS1 Syntax Engine.
*
* Copyright (c) 2022-2023 GS1 AISBL.
* Copyright (c) 2022-2024 GS1 AISBL.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -109,7 +109,7 @@ function process_clicked() {
gs1encoder.aiDataStr = data;
} else if (data.startsWith(']')) {
document.getElementById("syntax").value = "Barcode scan data with AIM symbology identifier";
gs1encoder.scanData = data.replace("{GS}", "\u001d");
gs1encoder.scanData = data.replace(/{GS}/g, "\u001d");
} else if (data.startsWith('^')) {
document.getElementById("syntax").value = "Unbracketed AI element string";
gs1encoder.dataStr = data;
Expand Down
2 changes: 1 addition & 1 deletion src/js-wasm/example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function process_clicked() {
gs1encoder.aiDataStr = data;
} else if (data.startsWith(']')) {
document.getElementById("syntax").value = "Barcode scan data with AIM symbology identifier";
gs1encoder.scanData = data.replace("{GS}", "\u001d");
gs1encoder.scanData = data.replace(/{GS}/g, "\u001d");
} else if (data.startsWith('^')) {
document.getElementById("syntax").value = "Unbracketed AI element string";
gs1encoder.dataStr = data;
Expand Down

0 comments on commit 9d929a6

Please sign in to comment.