![]() |
|
Javascript and Storage - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Javascript and Storage (/showthread.php?tid=3912) |
Javascript and Storage - esoulintzhs - 03.03.2022 Hi, Is there a way that I can read/write on Storage from JavaScript? I would like to create a keypad for the security system and I want to temporally construct the pin on the Storage so I don't cause traffic on the BUS. Thank you in advance RE: Javascript and Storage - admin - 04.03.2022 It's possible to use built-in pincode control as keypad input. In this example it attaches to an element with Additional class set to showpin. Clicking this element will show the pincode input. Once user inputs 4 numbers (length variable, adjust as needed) the pincode value is sent to 2/1/1. Custom JavaScript: Code: $(function() {
if (window.$E) {
// override pin check event to allow custom check callback
$E.pincode.off('check').on('check', function(event, control, pincode, data) {
if (data.checkcallback) {
checkPinResult(control, data.checkcallback(pincode, data));
}
else {
checkPinCallback(event, control, pincode, data);
}
});
$('.showpin').off('vclick').on('vclick', function() {
var length = 4; // pin code length
showPincode(length, {
checkcallback: function(pincode) {
grp.write('2/1/1', pincode);
return true;
},
// not used, do not remove
callback: function() {}
});
});
}
});RE: Javascript and Storage - esoulintzhs - 10.03.2022 Thanks for the answer, Is it possible to save it on Storage instead of writing it on an object? RE: Javascript and Storage - admin - 11.03.2022 Not possible directly. Why do you want to use storage? The pin script will send the whole code so you don't need to save it number by number. |