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.
And below we display the value in a Text Viewer block.
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.
Next we display the image by using the Image Box block.
For more details please see the corresponding documentation.
Leave a Reply
You must be logged in to post a comment.