Closed mhevery closed 2 years ago
Thank you for creating this issue! I think when I posted this in Discord I was reporting a few separate issues:
onDocumentEventName$
syntax is not being transformed correctly, resulting in DOM nodes with on:documenteventname
attributes (should be on-document:eventname
)on-window
and on-document
event listeners only fire handlers for specific arbitrary events, so the expensiveComputationDone
event fired by the partytown starter can't be listened for using Qwik syntax.They just all happened to come up in the context of getting the starter to run 😅 Love the idea, by the way!
Adding this for reference:
With console log the environments[msgValue] undefined
Fixed!
https://discord.com/channels/842438759945601056/937421500879867994/967628243962310748
Has anybody gotten the partytown starter to work properly? While debugging I've run into multiple odd issues regarding event handling (onDocument event handlers don't work, onWindow handler for a custom event doesn't work, etc)
Reproduction steps:
From what I could test, it actually seems like only very specific events are listened for at the window/document level, and handlers for custom events are not supported. For example, window:scroll cannot have a handler registered. Also, the onDocumentEventName$ syntax appears to be broken. The attribute applied to the element is on:documenteventname, which doesn't work. Changing the attribute name to on-document:eventname causes the handler to work - as long as eventname is scroll or some other standard event.
Further testing suggests that custom events such as element.dispatchEvent(new Event('foo')) are not supported via the <div onFoo$={...} /> syntax - is there a correct way to use custom events? It seems like the partytown starter not only doesn't work, it can't work.