Add the 'async' property to the onload function only when necessary

This commit is contained in:
OeildeLynx31 2024-04-15 17:11:27 +02:00
commit ededebe002

View file

@ -20,7 +20,7 @@ function register() {
//helpUrl: "#fullscreen",
}, (block) => {
const BLOCKS = javascriptGenerator.statementToCode(block, 'BLOCKS');
return `async function onload() {\n${BLOCKS}}`;
return `${BLOCKS.indexOf('await') > -1 ? 'async' : ''} function onload() {\n${BLOCKS}}`;
})
// setInterval