Skip to content

Commit

Permalink
feat(ripple): Add optional event parameters to activate/deactivate me…
Browse files Browse the repository at this point in the history
…thods
  • Loading branch information
aprigogin authored and Kenneth G. Franqueiro committed Oct 13, 2017
1 parent 36577ab commit 891e962
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions packages/mdc-ripple/foundation.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,6 @@ class MDCRippleFoundation extends MDCFoundation {
};
}

/**
* We compute this property so that we are not querying information about the client
* until the point in time where the foundation requests it. This prevents scenarios where
* client-side feature-detection may happen too early, such as when components are rendered on the server
* and then initialized at mount time on the client.
* @return {boolean}
*/
get isSupported_() {
return this.adapter_.browserSupportsCssVars();
}

constructor(adapter) {
super(Object.assign(MDCRippleFoundation.defaultAdapter, adapter));

Expand Down Expand Up @@ -187,6 +176,18 @@ class MDCRippleFoundation extends MDCFoundation {
};
}

/**
* We compute this property so that we are not querying information about the client
* until the point in time where the foundation requests it. This prevents scenarios where
* client-side feature-detection may happen too early, such as when components are rendered on the server
* and then initialized at mount time on the client.
* @return {boolean}
* @private
*/
isSupported_() {
return this.adapter_.browserSupportsCssVars();
}

/**
* @return {!ActivationStateType}
*/
Expand All @@ -203,7 +204,7 @@ class MDCRippleFoundation extends MDCFoundation {
}

init() {
if (!this.isSupported_) {
if (!this.isSupported_()) {
return;
}
this.addEventListeners_();
Expand Down Expand Up @@ -266,8 +267,11 @@ class MDCRippleFoundation extends MDCFoundation {
});
}

activate() {
this.activate_(null);
/**
* @param {?Event=} event Optional event containing position information.
*/
activate(event = null) {
this.activate_(event);
}

/** @private */
Expand Down Expand Up @@ -405,8 +409,11 @@ class MDCRippleFoundation extends MDCFoundation {
});
}

deactivate() {
this.deactivate_(null);
/**
* @param {?Event=} event Optional event containing position information.
*/
deactivate(event = null) {
this.deactivate_(event);
}

/**
Expand All @@ -424,7 +431,7 @@ class MDCRippleFoundation extends MDCFoundation {
}

destroy() {
if (!this.isSupported_) {
if (!this.isSupported_()) {
return;
}
this.removeEventListeners_();
Expand Down

0 comments on commit 891e962

Please sign in to comment.