Submit From Live Data

Some scenarios require setInterval or other "live data" utils. This means you can't use await on the arg/div/textarea/etc because await prevents the script from continuing on to start the setInterval.

CleanShot 2021-11-28 at 08 58 04

Use the Promise then on arg/div/textarea/etc to allow the script to continue to run to the setInterval. Inside of the then callback, you will have to clear the interval for your script to continue/complete:

let intervalId = 0
div(md(`Click a value`)).then(async value => {
clearInterval(intervalId)
await div(md(value))
})
intervalId = setInterval(() => {
let value = Math.random()
setPanel(
md(`
[${value}](submit:${value})
`)
)
}, 1000)
Discuss Post