Hacker News new | ask | show | jobs
by paldepind2 595 days ago
Thanks for the reply. I can understand that the purpose here isn't to be as powerful as JavaScript, but rather to be simpler and easier. That being said, is there a way to achieve the below or is that beyond the limits?

    const result = Promise.race(job1(), job2());
1 comments

You can't achieve that with the intended semantics directly in hyperscript, because it will resolve all argument promises before invoking Promise.race()

You could move that out to JavaScript and then call that function from hyperscript:

  set result to jsPromiseRace()
it could also be done as inline js:

  js
    return Promise.race(job1(), job2());
  end
  log the result
but I think if you are writing this style of code it makes more sense to just kick out to JavaScript for it.