Closed terrywarwar closed 8 years ago
This is mentioned in the changelog for 1.0.0-rc.12
, and is unfortunately working as intended. In polymer JS they now just add a detail
field to regular event objects, instead of using a real CustomEvent. Afaik this is a performance thing, as it allows them to re-use event objects and just change the detail field.
This is primarily an issue when using the regular dom apis to listen for events, the polymer apis (@Listen
, etc) will automatically convert it for you. The simplest solution is something like this:
document.addEventListener("add-to-alert",(e){
e = convertToDart(e);
print(e.detail);
}) ;
I have a global listener
And then I fire an event:
I can no longer read the detail property and I get the following error
It works when I use
convertToDart(e.detail)
. Is that the correct method? It was working before without it.