Skip to main content

Code

The "Code" block allows you to execute Javascript code. If you want to set a variable value with Javascript, use the Set variable block instead.

It doesn't allow you to create a custom visual block

Code block

Examples

Reload page

window.location.reload()

Wait for 3 seconds

By default, Promises will be awaited. So something like this will work:

return new Promise((res) => setTimeout(res, 3000))

Post a message to parent

postMessage('hello there!', '*')

Then on your parent website, you could listen for those messages:

addEventListener('message', ({ data }) => console.log(data))

Do you need to do something but you're not sure how to? Ask the community for help!