/
JS Blocks

JS Blocks

About

The JS Blocks editor allows the user to use blocks to generate javascript code.

The generated code from the above diagram:

Commands

Cut, copy and paste

Use this commands to move block to and from clipboard.

Accessing program's variables

Access the program variables.

Adding virtual points

Add virtual points to use them in the block editor.

Undo and Redo

Undo an action or redo it (after undo).

Blocks

Actions

CSS

addClass

add a single class to a component

addMultiClasses and removeMultiClasses

add multple classes to a component or remove multiple classes from a component

multiStyles

add multiple styles properties to a component

setComponentStyle

set a single style property to a component

hide

hide one or more components

toggleVisibility

toggle the visibility of one or several components

moveTo

move a component

refreshPoints

refresh one or several points

runProgram

run a program on one or several components

Math

foldCol

this blocks apply a function on a column of a table

onOffToBool

this block transforms "Off" and "off" to false and everything else (including "On" and "on") to true

Control Flow

forEach

runs an action on each element of an input array

Querying

component

use this block to select a single component

finstackEval

use this block to evaluate axon code

query

use this block to return a single result

queryAll

use this block return multiple results

Time

setTimeout

do some actions after waiting a delay

toDaysHrsMins

Transform a period of time into a string representation of days, hours and minutes

Examples

Coils and Fan Example

an example that uses the switch block and other blocks like multiActions, multiQueries, multiSetValue and getCurVal



Related content

GB JavaScript Tips
GB JavaScript Tips
Read with this
Coils and fan example
Coils and fan example
More like this
GB JavaScript API
GB JavaScript API
Read with this
Sub Block
Sub Block
More like this
Ractive Table
Ractive Table
Read with this
Selector Component
Selector Component
More like this