-
-
Notifications
You must be signed in to change notification settings - Fork 866
HowTo configure Script
To configure scripts going to Scripts in editor.
Add a new script (a script is a javascript function), configure the function name and parameters, there are 2 type of parameters:
- Tag ID
- Value, number or string
Then you write your logic into the function. There are system call that you can use:
- $setTag, to set value of Tag
- $getTag, to get current Tag value
You can test the script, to verify it makes sense to use the console.log method.
From the GUI you can configure in Events the call of script.
If you use intervals in a script it's important you handle them correctly. For example if you have setInterval in a script and run the test multiple times this will create a new interval each time calling the same piece of code and you will have to restart Fuxa to clear it. One method to handle this is assign an ID to the interval and do a simple check if it exist.
if (typeof globalThis.myTimer === 'undefined') globalThis.myTimer = null;
if (!globalThis.myTimer) globalThis.myTimer = setInterval(myTimerFunction, 1000);
async function myTimerFunction() {
//myTimer code here every 1 sec
}
powered from frangoteam
- Home
- Getting Started
- Installing and Running
- HowTo Devices and Tags
- HowTo bind Controls
- HowTo Chart Control
- HowTo UI Layout
- HowTo setup Alarms
- HowTo define Shapes
- HowTo animate Pipe
- HowTo save/load Project
- HowTo configure events
- HowTo use same view
- HowTo configure Script
- HowTo configure ODBC
- HowTo Widgets
- HowTo WebSockets
- Settings
- Tips and Tricks