Skip to content

Commit

Permalink
js-wasm: Accept a data URI parameter in the browser demo
Browse files Browse the repository at this point in the history
  • Loading branch information
terryburton committed Jul 17, 2024
1 parent 6919215 commit 17cc7fe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion docs/demo/example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,16 @@ async function init() {

document.title = "GS1 Syntax Engine HTML demo | Library release: " + gs1encoder.version;

document.getElementById("data").value = "https://example.com/01/12312312312333/10/ABC123?99=TESTING";
var dataParam = new URL(document.location.toString()).searchParams.get('data');

document.getElementById("data").value = dataParam ??
"https://example.com/01/12312312312333/10/ABC123?99=TESTING";

load_data_values();

if (dataParam)
process_clicked();

}


Expand Down
8 changes: 7 additions & 1 deletion src/js-wasm/example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,16 @@ async function init() {

document.title = "GS1 Syntax Engine HTML demo | Library release: " + gs1encoder.version;

document.getElementById("data").value = "https://example.com/01/12312312312333/10/ABC123?99=TESTING";
var dataParam = new URL(document.location.toString()).searchParams.get('data');

document.getElementById("data").value = dataParam ??
"https://example.com/01/12312312312333/10/ABC123?99=TESTING";

load_data_values();

if (dataParam)
process_clicked();

}


Expand Down

0 comments on commit 17cc7fe

Please sign in to comment.