You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You need a way to detect if an event was cancelled just like the platform does. Normally dispatchEvent() has a return value, and the event has a way to check if the default was prevented. Polymer should expose this value:
if (this.fire("some-event")) {
// do something, the default was not prevented.
}
this.asyncFire("some-event").then(function() {
// do something, the default was not prevented.
});
There's no way to fire an event today and let consumers cancel it which is causing issues in some of my apps where I want to do things like trap all key presses, dispatch a custom event to instances like polymer-signals does, and then only allow the native keypress action to happen if the default is not prevented.
The text was updated successfully, but these errors were encountered:
It would be better if asyncFire returned a Promise, but we are reluctant to include the Promise polyfill unless we really need it. For now, I would suggest just unrolling it like so:
You need a way to detect if an event was cancelled just like the platform does. Normally dispatchEvent() has a return value, and the event has a way to check if the default was prevented. Polymer should expose this value:
if (this.fire("some-event")) {
// do something, the default was not prevented.
}
this.asyncFire("some-event").then(function() {
// do something, the default was not prevented.
});
There's no way to fire an event today and let consumers cancel it which is causing issues in some of my apps where I want to do things like trap all key presses, dispatch a custom event to instances like polymer-signals does, and then only allow the native keypress action to happen if the default is not prevented.
The text was updated successfully, but these errors were encountered: