I’m pretty new to JS, but trying to learning all the time.
Some of the first code I wrote in the scripting blog has gotten supper hard to update, so thought to experiment to write small modules to keep divide up the code.
However it seems I can’t put buttons into functions?
let test = function () {
let firstClick = await input.buttonsAsync(
'What do you want to do?',
[
{label: 'Check todays rate', value: 'today', variant: 'danger'},
{label: 'Convert currency', value: 'convert', variant: 'primary'}
]
)
}
this gives me an error saying ‘SyntaxError: await is only valid in async function’
does theis mean my button can only be used in the global scope?