bigskysoftware / bigskysoftware/_hyperscript
Wait for <x> and <y>
- Lenguaje dominante
- JavaScript
- Estrellas
- 3.8k
- Forks
- 172
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Comienza localizando la sintaxis `wait` de hyperscript y el flujo controlado por eventos descrito en el issue. Usa el ejemplo proporcionado con `animationend` y `fetchDone` para examinar el comportamiento cuando cualquiera de los dos eventos ocurre primero. Se considera completado cuando una forma `wait for x and y` reanuda la ejecución solo después de que ambos eventos se hayan disparado, sin bloquearse cuando cambia su orden.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript
- Área
- web-dev
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100