Skip to content

Commit

Permalink
currentToast instead of PaperToast.currentToast
Browse files Browse the repository at this point in the history
  • Loading branch information
valdrinkoshi committed Nov 25, 2015
1 parent b0c1ebb commit 4b1e7fd
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions paper-toast.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@

<script>
(function() {
var PaperToast = Polymer({
// Keeps track of the toast currently opened.
var currentToast = null;

Polymer({
is: 'paper-toast',

behaviors: [
Expand Down Expand Up @@ -141,19 +144,19 @@
*/
_openedChanged: function() {
if (this.opened) {
if (PaperToast.currentToast && PaperToast.currentToast !== this) {
PaperToast.currentToast.close();
if (currentToast && currentToast !== this) {
currentToast.close();
}
PaperToast.currentToast = this;
currentToast = this;
this.fire('iron-announce', {
text: this.text
});
// auto-close if duration is a positive finite number
if (this.duration > 0 && this.duration !== Infinity) {
this.debounce('close', this.close, this.duration);
}
} else if (PaperToast.currentToast === this) {
PaperToast.currentToast = null;
} else if (currentToast === this) {
currentToast = null;
}
Polymer.IronOverlayBehaviorImpl._openedChanged.apply(this, arguments);
},
Expand Down

0 comments on commit 4b1e7fd

Please sign in to comment.