Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait for <x> and <y> #78

Open
benpate opened this issue Mar 15, 2021 · 0 comments
Open

Wait for <x> and <y> #78

benpate opened this issue Mar 15, 2021 · 0 comments

Comments

@benpate
Copy link
Contributor

benpate commented Mar 15, 2021

The wait syntax in hyperscript does a great job of enabling event controlled flow. However, it has trouble when waiting on more than one event at the same time. For example:

on closeModal(event) 
    add .closing to #modal 
    async do 
        if theURL is not null then 
            fetch theURL then 
            put it into #main.innerHTML
        end
        trigger fetchDone
    end
    wait for animationend
    wait for fetchDone
    remove #modal
end

This should work if animationend finishes before fetchDone, but it deadlocks if fetchDone completes first.

I think hyperscript would benefit from a wait for x and y syntax that is similar to Promise.all() that only returns after all of the events have triggered.

This might be generalized to other kinds of operations, such as wait for any of x and y and z but my first guess is that this would be less commonly useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant