Skip to content

Commit 673c223

Browse files
committed
Merge pull request #36 from PolymerElements/type-annotations
Add more type annotations
2 parents 576e938 + 04e4b94 commit 673c223

2 files changed

Lines changed: 25 additions & 13 deletions

File tree

paper-button-behavior.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@
6464
},
6565

6666
/**
67-
* In addition to `IronButtonState` behavior, when space key goes down,
67+
* In addition to `IronButtonState` behavior, when space key goes down,
6868
* create a ripple down effect.
69+
*
70+
* @param {!KeyboardEvent} event .
6971
*/
7072
_spaceKeyDownHandler: function(event) {
7173
Polymer.IronButtonStateImpl._spaceKeyDownHandler.call(this, event);
@@ -75,8 +77,10 @@
7577
},
7678

7779
/**
78-
* In addition to `IronButtonState` behavior, when space key goes up,
80+
* In addition to `IronButtonState` behavior, when space key goes up,
7981
* create a ripple up effect.
82+
*
83+
* @param {!KeyboardEvent} event .
8084
*/
8185
_spaceKeyUpHandler: function(event) {
8286
Polymer.IronButtonStateImpl._spaceKeyUpHandler.call(this, event);

paper-ripple-behavior.html

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313

1414
<script>
1515

16-
/**
17-
* `Polymer.PaperRippleBehavior` dynamically implements a ripple
16+
/**
17+
* `Polymer.PaperRippleBehavior` dynamically implements a ripple
1818
* when the element has focus via pointer or keyboard.
1919
*
2020
* NOTE: This behavior is intended to be used in conjunction with and after
2121
* `Polymer.IronButtonState` and `Polymer.IronControlState`.
2222
*
23-
* @polymerBehavior Polymer.PaperRippleBehavior
23+
* @polymerBehavior Polymer.PaperRippleBehavior
2424
*/
2525
Polymer.PaperRippleBehavior = {
2626

@@ -32,11 +32,18 @@
3232
noink: {
3333
type: Boolean,
3434
observer: '_noinkChanged'
35+
},
36+
37+
/**
38+
* @type {Element|undefined}
39+
*/
40+
_rippleContainer: {
41+
type: Object,
3542
}
3643
},
3744

3845
/**
39-
* Ensures a `<paper-ripple>` element is available when the element is
46+
* Ensures a `<paper-ripple>` element is available when the element is
4047
* focused.
4148
*/
4249
_buttonStateChanged: function() {
@@ -45,7 +52,7 @@
4552
}
4653
},
4754

48-
/**
55+
/**
4956
* In addition to the functionality provided in `IronButtonState`, ensures
5057
* a ripple effect is created when the element is in a `pressed` state.
5158
*/
@@ -57,9 +64,9 @@
5764
},
5865

5966
/**
60-
* Ensures this element contains a ripple effect. For startup efficiency
67+
* Ensures this element contains a ripple effect. For startup efficiency
6168
* the ripple effect is dynamically on demand when needed.
62-
* @param {!Event=} opt_triggeringEvent (optional) event that triggered the
69+
* @param {!Event=} opt_triggeringEvent (optional) event that triggered the
6370
* ripple.
6471
*/
6572
ensureRipple: function(opt_triggeringEvent) {
@@ -70,7 +77,7 @@
7077
if (rippleContainer) {
7178
Polymer.dom(rippleContainer).appendChild(this._ripple);
7279
}
73-
var domContainer = rippleContainer === this.shadyRoot ? this :
80+
var domContainer = rippleContainer === this.shadyRoot ? this :
7481
rippleContainer;
7582
if (opt_triggeringEvent &&
7683
domContainer.contains(opt_triggeringEvent.target)) {
@@ -82,7 +89,7 @@
8289
/**
8390
* Returns the `<paper-ripple>` element used by this element to create
8491
* ripple effects. The element's ripple is created on demand, when
85-
* necessary, and calling this method will force the
92+
* necessary, and calling this method will force the
8693
* ripple to be created.
8794
*/
8895
getRipple: function() {
@@ -101,10 +108,11 @@
101108
/**
102109
* Create the element's ripple effect via creating a `<paper-ripple>`.
103110
* Override this method to customize the ripple element.
104-
* @return {element} Returns a `<paper-ripple>` element.
111+
* @return {!PaperRippleElement} Returns a `<paper-ripple>` element.
105112
*/
106113
_createRipple: function() {
107-
return document.createElement('paper-ripple');
114+
return /** @type {!PaperRippleElement} */ (
115+
document.createElement('paper-ripple'));
108116
},
109117

110118
_noinkChanged: function(noink) {

0 commit comments

Comments
 (0)