JavaScript Code Block

The JavaScript Code Block allows to run JavaScript code in a separate web worker. It is therefore ideal for performing computations in the background.

It is possible to install new packages using importScripts. For example we will get the current date and time.

The JavaScript block can run on demand (press Run), automatically, and one can even hide it.

is loading …

And below we display the value in a Text Viewer block.

is loading …

The block allows asynchronous behaviour and await is permitted within the main body of the code. Imagine that we want to fetch an image. We can use fetch directly without having it within an async function.

is loading …

Next we display the image by using the Image Box block.

is loading …

For more details please see the corresponding documentation.


First Published

in

Last Updated

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *