Worker caveats
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 42/100
- Tipo de issue
- Documentación
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- documentation
Línea de trabajo
Start with the FAQ section and review the linked SVG image demo, especially the ordering of listener registration and the inline image source. Document the listener-ordering caveat for main and worker contexts, with guidance to register bootstrap listeners ahead of time; the FAQ is done when this scenario and the recommended ordering are clear.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I just realized, out of a one-off example in Discord, that if a worker has listeners added after some reference is created or populated with values, the synchronous dance might mislead because that reference on the main might have been already bootstrapped or triggered/resolved.
The explicit issue I am talking about is this one:
image = window.Image.new()
# if this is before, we're all good
image.onload = lambda e: document.body.append(image)
# if that is after though, setting an inline source of the image
# will resolve it before the next `.onload = ...` or even
# `.addEventListener` is attached
image.src = f'data:image/svg+xml;utf8,{svg}'
The demo in case is this one https://pyscript.com/@agiammarchi/svg-image/latest?files=main.py,index.html
I had to double-check why, once added the worker attribute, that would not work.
Due inability to hook into listeners happening on the main, I think it's worth it to document the best way to be sure a listener is triggered, either on main or worker thread, is to define listeners related to such bootstrap AOT (Ahead of Time) and not later.
This is an important detail I could see myself failing at remembering on occasions, so I think it should be part, at least, of our F.A.Q.s section.
- Lenguaje dominante
- Python
- Estrellas
- 17
- Forks
- 20
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pyscript/docs
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 32/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
Todos los issues de pyscript/docs
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
OpenHands/extensions#626 · 1 comentario ·
-
Change observation tooltip text Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
CSCfi/sd-search-api#39 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
-
please add to porn list Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
StevenBlack/hosts#3255 ·