
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
22 lines
750 B
HTML
22 lines
750 B
HTML
<!--
|
|
Copyright (C) 2017 The Android Open Source Project
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
|
|
<link rel="import" href="../../../bower_components/polymer/polymer.html">
|
|
|
|
<dom-module id="gr-event-helper">
|
|
<script src="gr-event-helper.js"></script>
|
|
</dom-module>
|