Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Third example only works if aJavascriptFunction is sync. If it's async you'd have to do

  <div onclick="aJavascriptFunction().then(r => setTimeout(anotherJavascriptFunction, 10000)">Do some stuff</div>
but if you don't know ahead of time whether or not it's async (or don't want to have to care, like hyperscript allows), then you'd need

  <div onclick="(async () => { await aJavascriptFunction(); setTimeout(anotherJavascriptFunction, 10000) })()">Do some stuff</div>


Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: