mirror of
https://github.com/silenty4ng/k5web
synced 2025-01-06 20:02:38 +00:00
del init
This commit is contained in:
parent
828e21f05f
commit
4245b47ea5
1 changed files with 0 additions and 34 deletions
|
@ -1,5 +1,3 @@
|
|||
window.addEventListener("load", initiate, false);
|
||||
|
||||
//The different hardware we support + their specific data/configs
|
||||
const table = {
|
||||
0x0403: {"FTDI": {
|
||||
|
@ -353,35 +351,3 @@ function send(string) {
|
|||
port.send(data);
|
||||
}
|
||||
}
|
||||
|
||||
//the init function which we have an event listener connected to
|
||||
function initiate(){
|
||||
serial.getPorts()
|
||||
.then(ports => {
|
||||
//these are devices already paired, let's try the first one...
|
||||
if (ports.length > 0) {
|
||||
port = ports[0];
|
||||
connect();
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector("#connect").onclick = async function () {
|
||||
await serial.requestPort().then(selectedPort => {
|
||||
if (port === undefined || port.device_ !== selectedPort.device_) {
|
||||
port = selectedPort;
|
||||
connect();
|
||||
} else {
|
||||
// port already selected...
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.querySelector("#disconnect").onclick = function() {
|
||||
disconnect()
|
||||
}
|
||||
|
||||
document.querySelector("#submit").onclick = () => {
|
||||
let source = document.querySelector("#editor").value;
|
||||
send(source);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue