-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<!-- | ||
LibHaLo - Programmatically interact with HaLo tags from the web browser, mobile application or the desktop. | ||
Copyright by Arx Research, Inc., a Delaware corporation | ||
License: MIT | ||
--> | ||
<title>LibHaLo Demo</title> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" | ||
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous"> | ||
|
||
<script type="text/javascript"> | ||
// ensure the library is always fully reloaded | ||
document.write('<script src="../dist/libhalo.js?_v=' + ( | ||
Math.random() + '') + '"></scr' + 'ipt>'); | ||
</script> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>LibHaLo Demo</h1> | ||
<p class="text-muted"> | ||
Get information about the specific key slot. | ||
</p> | ||
<div class="mb-3"> | ||
<label class="form-label">Target key slot</label> | ||
<input type="text" class="form-control" id="keyNo" value="1" placeHolder="e.g. 2"> | ||
</div> | ||
|
||
<button class="btn btn-primary" onclick="btnClicked()">Target key slot</button> | ||
<p id="noArgsError" class="text-danger mt-3" style="display:none">Please provide target key slot</p> | ||
|
||
<pre id="statusText" style="word-break: break-all; white-space: pre-wrap;"></pre> | ||
|
||
<script type="text/javascript"> | ||
function log(data) { | ||
console.log(data); | ||
document | ||
.getElementById('statusText') | ||
.innerText += '\n' + data; | ||
} | ||
|
||
async function btnClicked() { | ||
// Extract keyNo from input field | ||
const keyNo = document | ||
.getElementById('keyNo') | ||
.value; | ||
|
||
// Handle displaying/hiding the noArgsError message | ||
if (!keyNo) { | ||
document | ||
.getElementById('noArgsError') | ||
.style | ||
.display = 'block'; | ||
return; | ||
} else { | ||
document | ||
.getElementById('noArgsError') | ||
.style | ||
.display = 'none'; | ||
} | ||
|
||
// Prepare payload | ||
const cmd = { | ||
name: "get_key_info", | ||
keyNo | ||
}; | ||
|
||
try { | ||
log("Executing command: " + JSON.stringify(cmd)); | ||
let result = await execHaloCmdWeb(cmd); | ||
log(JSON.stringify(result)); | ||
} catch (e) { | ||
log(JSON.stringify(e)); | ||
} | ||
} | ||
</script> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters