mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 17:11:52 +08:00
prefer sync api
This commit is contained in:
@@ -99,7 +99,8 @@ export function Gpio() {
|
||||
tools.setOnClick($(`gpio-switch-${channel}`), () => __switchChannel(channel));
|
||||
}
|
||||
for (let channel of buttons) {
|
||||
tools.setOnClick($(`gpio-button-${channel}`), () => __pulseChannel(channel));
|
||||
let wait = (model.scheme.outputs[channel].pulse.delay <= 1);
|
||||
tools.setOnClick($(`gpio-button-${channel}`), () => __pulseChannel(channel, wait));
|
||||
}
|
||||
|
||||
self.setState(__state);
|
||||
@@ -149,8 +150,8 @@ export function Gpio() {
|
||||
__sendPost(`/api/gpio/switch?channel=${channel}&state=${to}`);
|
||||
};
|
||||
|
||||
var __pulseChannel = function(channel) {
|
||||
__sendPost(`/api/gpio/pulse?channel=${channel}`);
|
||||
var __pulseChannel = function(channel, wait) {
|
||||
__sendPost(`/api/gpio/pulse?channel=${channel}&wait=${wait ? "1" : "0"}`);
|
||||
};
|
||||
|
||||
var __sendPost = function(url) {
|
||||
|
||||
Reference in New Issue
Block a user