Files
gerrit/polygerrit-ui/app/elements/plugins/gr-event-helper
Viktar Donich ae7c9618d3 Low-level plugin event helper API
Can be used to listen to tap evens (i.e. click/touch), preventing their
bubbling, or preventing normal execution. To stop either bubbling or
normal execution, callback should explicitly return false. By default,
bubbling and normal execution is not prevented.

onTap() adds a listener to a click or touch event to element wrapped
with event helper.

captureTap() installs a capture phase listener and callback returning
false at that moment intercepts tap before any action is taken by other
listeners (i.e. PolyGerrit buttons).

Sample code

``` js
Gerrit.install(plugin => {
  plugin.hook('reply-text').onAttached(element => {
    if (!element.content) { return; }
    plugin.eventHelper(element.content).onTap(() => {
      console.log('reply test tapped!');
    });
    plugin.eventHelper(element.content).captureTap(() => {
      // Prevent onTap() handler from being called.
      return false;
    });
  });
});
```

Change-Id: Ie10169e2c801ce85590e4f700e6041e9c8a02bff
2017-09-15 15:32:04 -07:00
..