Closed zoechi closed 8 years ago
There is a basic test here which is passing https://github.com/dart-lang/polymer_interop/blob/1.0.0-rc.5/test/polymer_base_test.dart#L152. Seems like an issue with the element?
It's often helpful to talk to someone about the problem ;-)
I added async(...)
and now it's working.
This is the 2nd time I run into this issue. It seems to work in JS but not in Dart when code is run from a property observer. There seems to be some timing difference.
And thanks for looking into it :+1:
Definitely weird, I will look into this a bit.
Hmm I actually don't see the error? Tried regular server in dartium as well as pub serve in dartium/chrome.
Now I can't anymore either :disappointed: or better :smile:
Maybe it worked all the time, but I have no idea why the breakpoint didn't hit previously, but then with async()
it did.
I now run into another issue. Maybe this tricked me into thinking that the event wasn't processed.
When I call
var result = fire('syntax-highlight', detail: {'code': code, 'lang': lang});
result.detail['code']
should return the highlighted result but I get the result only with this code
(result as CustomEventWrapper).original.detail['code'];
Actually I still need async()
Could this depend on the performance of the used machine? Mine is a bit outdated. It was a powerful notebook once, but is now several years old.
It certainly could, although I would hope its not haha. I think its more likely different dartium versions or something along those lines.
Ok, I'll monitor it and try to find a way to make it reproducable.
What do you think about the detail
not being updated on the return value of fire(...)
?
What do you think about the detail not being updated on the return value of fire(...)?
Not sure on that one, definitely should work. I can investigate it shortly.
hmm I just tried
var event = fire('my-event', detail: {'foo': 'bar'});
print(event.detail['foo']);
and that printed bar
as expected?
In the demo where I run into this, an event handler updates the detail
content, and this updated data is not available (only in event.original.detail
).
The value I passed to fire()
was there, but that's not what's needed.
oh... ya that is just not going to work today :(
been debating this for a while.... but we could just implement a wrapper around JsObject instead of converting them to a Map. That is probably the safer choice but definitely a breaking change. Could do the same for List/JsArray as well.
closing as a dupe of https://github.com/dart-lang/polymer-dart/issues/586
https://github.com/bwu-dart/polymer_elements_demos/blob/6f21c3acdea85b5e7c98494951e23475bc15dd22/web/prism_element/prism_demo.dart#L38
The
<prism-highlighter>
(in the local DOM) listens forsyntax-highlight
on the parent (<prism-demo>
) but doesn't receive the event. When I add an event handler in<prism-demo>
itself, it also doesn't receive the event.Should this work this way?