This list is currently incomplete! Trndi supports extensions, written in JavaScript.
You can declare functions inside Trndi and expose them to JS, or "listen" for functions in Trndi.
Trndi supports promises and async code! See the guide for information on how to install them.
Shows a pop-up
This triggers
JsDoAlert()
in trndi.ext.jsbase.inc
Creates a log popup.
This triggers
JSConsoleLog()
in trndi.ext.functions.pp }
Modifies the Trndi UX
Directly inputs a query to the backend, to get recent readings. (min: int, max: int)
This triggers
TJSFuncs.bgDump()
in trndi.ext.jsfuncs.pp }
Fetches a URL and returns the data. (url: string)
This triggers
TJSFuncs.asyncGet()
in trndi.ext.jsfuncs.pp }
Allows for a direct, unfiltered, query to the backend service
Triggers when a uxProp has completed.
Returns array: [component, value:string]
NOTE: There is full ES2023 language support.
Trndi creates the TrndiExtension object.
// Get a file and display the result in the GUI
asyncGet("https://sample-files.com/downloads/documents/txt/simple.txt")
.then(result => console.log(result))
.catch(error => console.log(`Error: ${error}`));
// Display a GUI update
function uxCallback(a,b){
alert(`Changed: ${a} with ${b}`);
}
// Change element colors
function color(){
// Change a UX property of the main form
uxProp('ldiff', 'font-color', '#000000');
uxProp('ldiff', 'font', 'Comic Sans');
}
color();
This is a theoretical command, I havent tested it:
runCMD("app", `-v;--url;"smtps://smtp.gmail.com:465";--mail-from;[email protected]";--mail-rcpt;"[email protected]";--mail-data;"Email";--user;"[email protected]:APP-PASSWORD"`, ";").then(result => console.log(result))
.catch(error => console.log(`Error: ${error}`));
As you see spaces are replaced with ";" to allow spaces inside params. The last parameter actually defines where to split the paraneters. you can use `${X}" to pass data, if calling from a callback eg