Added function calls for UI
This commit is contained in:
24
www/main.js
24
www/main.js
@ -24,7 +24,6 @@ function assert(condition, message) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function transmit(transmitterID, channel, action, intensity=0, lucalEncoded=false) {
|
async function transmit(transmitterID, channel, action, intensity=0, lucalEncoded=false) {
|
||||||
assert(typeof transmitterID === 'number');
|
assert(typeof transmitterID === 'number');
|
||||||
assert(typeof channel === 'number');
|
assert(typeof channel === 'number');
|
||||||
@ -34,4 +33,25 @@ async function transmit(transmitterID, channel, action, intensity=0, lucalEncode
|
|||||||
POST('/transmit', {transmitterID: transmitterID, channel: channel, action: action, intensity: intensity, lucalEncoded: lucalEncoded});
|
POST('/transmit', {transmitterID: transmitterID, channel: channel, action: action, intensity: intensity, lucalEncoded: lucalEncoded});
|
||||||
}
|
}
|
||||||
|
|
||||||
console.debug('Main loaded!');
|
|
||||||
|
|
||||||
|
async function txFromUI(action, intensity=0) {
|
||||||
|
let transmitterID = Number(document.getElementById('CHANGE_ME').value);
|
||||||
|
let channel = Number(document.getElementById('CHANGE_ME').value);
|
||||||
|
let lucalEncoded = document.getElementById('CHANGE_ME').checked;
|
||||||
|
transmit(transmitterID, channel, action, intensity, lucalEncoded);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function shock() {
|
||||||
|
let intensity = Number(document.getElementById('CHANGE_ME').value);
|
||||||
|
txFromUI('shock', intensity);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function vibrate() {
|
||||||
|
let intensity = Number(document.getElementById('CHANGE_ME').value);
|
||||||
|
txFromUI('vibrate', intensity);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function beep() {
|
||||||
|
txFromUI('beep');
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user