Skip to content

Commit

Permalink
Rename major methods to avoid conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
bennypowers committed Aug 15, 2017
1 parent f0de771 commit 26551e3
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions power-pop.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
let anim = document.createElement('power-pop');
anim.target = this;
document.body.appendChild(anim);
anim.animate(style);
anim.animatePop(style);
});
}
Expand Down Expand Up @@ -74,9 +74,11 @@
properties: {
/**
* The name of the animation to run.
* @type {String}
*/
animation: String,
animation: {
type: String,
value: 'success',
},

/**
* The element to animate in
Expand Down Expand Up @@ -136,15 +138,19 @@
this.target = this.target || this.parentNode;
},

animate: function(animation) {
if (animation) { this.animation = animation; }
animatePop: function(animation) {
this.animation = animation || this.animation;
this.center();
this.refit();
var color = this._getColor(this.animation);
this.updateStyles({'--icon-color': 'var(--paper-' + color + '-500)'});
this.playAnimation('entry');
this.playing = true;
this.dispatchEvent(new CustomEvent('power-pop', {bubbles: true, composed: true}));
const bubbles = true;
const composed = true;
const detail = this.animation;
const options = {bubbles, composed, detail};
this.dispatchEvent(new CustomEvent('power-pop', options));
},

_targetChanged: function(target) {
Expand Down

0 comments on commit 26551e3

Please sign in to comment.