mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-31 18:11:54 +08:00
fixed closure
This commit is contained in:
@@ -96,17 +96,21 @@ export function Gpio() {
|
|||||||
for (let channel in model.scheme.outputs) {
|
for (let channel in model.scheme.outputs) {
|
||||||
let el = $(`gpio-switch-${channel}`);
|
let el = $(`gpio-switch-${channel}`);
|
||||||
if (el) {
|
if (el) {
|
||||||
tools.setOnClick(el, () => __switchChannel(el));
|
tools.setOnClick(el, __createAction(el, __switchChannel));
|
||||||
}
|
}
|
||||||
el = $(`gpio-button-${channel}`);
|
el = $(`gpio-button-${channel}`);
|
||||||
if (el) {
|
if (el) {
|
||||||
tools.setOnClick(el, () => __pulseChannel(el));
|
tools.setOnClick(el, __createAction(el, __pulseChannel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.setState(__state);
|
self.setState(__state);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var __createAction = function(el, action) {
|
||||||
|
return () => action(el);
|
||||||
|
};
|
||||||
|
|
||||||
var __createItem = function(item) {
|
var __createItem = function(item) {
|
||||||
if (item.type === "label") {
|
if (item.type === "label") {
|
||||||
return item.text;
|
return item.text;
|
||||||
|
|||||||
Reference in New Issue
Block a user