Actions calling JavaScript

In general Fore is a Turing-conplete language to build applications for the browser platform and you can avoid the use of JavaScript altogether.

But once you want to integrate with some third-party components you are often thrown back and have to use some glue-code. Besides custom functions you can use a script action to knock the backdoor of Fore.

Use responsibly!

For security reasons the script needs to be external. Also you should make sure to wrap your script in curly brackets to put it into its own scope. Otherwise repeated executions might fail with errors.

Special testing and precautions should be considered when using script.

Open the browser console to see the instance data logged.

The JavaScript used here (test.js):

As Fore elements are usual DOM elements we can of course also use their API directly to get to our data by searching for the fx-instance and using its instanceData property. This will hold the actual data and can be queried simply with querySelector.