bigskysoftware / bigskysoftware/_hyperscript
Wait for <x> and <y>
- Lingua principale
- JavaScript
- Stelle
- 3.8k
- Fork
- 172
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia individuando la sintassi `wait` di hyperscript e il flusso controllato dagli eventi descritto nell’issue. Usa l’esempio fornito con `animationend` e `fetchDone` per esaminare il comportamento quando uno dei due eventi si verifica per primo. Il lavoro è completato quando una forma `wait for x and y` riprende solo dopo che entrambi gli eventi sono stati attivati, senza bloccarsi quando il loro ordine cambia.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- web-dev
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100