dcf163daef5499036e2cc4fe0397198f8be2fe06
[factbooks] /
1 <!--
2 @license
3 Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 -->
10 <link rel="import" href="../utils/boot.html">
11 <link rel="import" href="../utils/gestures.html">
12
13 <script>
14 (function() {
15
16   'use strict';
17
18   const gestures = Polymer.Gestures;
19
20   /**
21    * Element class mixin that provides API for adding Polymer's cross-platform
22    * gesture events to nodes.
23    *
24    * The API is designed to be compatible with override points implemented
25    * in `Polymer.TemplateStamp` such that declarative event listeners in
26    * templates will support gesture events when this mixin is applied along with
27    * `Polymer.TemplateStamp`.
28    *
29    * @polymerMixin
30    * @memberof Polymer
31    * @summary Element class mixin that provides API for adding Polymer's cross-platform
32    * gesture events to nodes
33    */
34   Polymer.GestureEventListeners = Polymer.dedupingMixin(superClass => {
35
36     /**
37      * @polymerMixinClass
38      * @implements {Polymer_GestureEventListeners}
39      */
40     class GestureEventListeners extends superClass {
41
42       _addEventListenerToNode(node, eventName, handler) {
43         if (!gestures.addListener(node, eventName, handler)) {
44           super._addEventListenerToNode(node, eventName, handler);
45         }
46       }
47
48       _removeEventListenerFromNode(node, eventName, handler) {
49         if (!gestures.removeListener(node, eventName, handler)) {
50           super._removeEventListenerFromNode(node, eventName, handler);
51         }
52       }
53
54     }
55
56     return GestureEventListeners;
57
58   });
59
60 })();
61 </script>