mirror of
https://github.com/google/material-design-lite.git
synced 2024-08-16 15:50:34 +03:00
Add Snackbar hide method
This commit is contained in:
parent
fd21836fd4
commit
03120bb944
@ -38,6 +38,7 @@
|
||||
this.actionHandler_ = undefined;
|
||||
this.message_ = undefined;
|
||||
this.actionText_ = undefined;
|
||||
this.timeoutID_ = undefined;
|
||||
this.queuedNotifications_ = [];
|
||||
this.setActionHidden_(true);
|
||||
};
|
||||
@ -86,7 +87,7 @@
|
||||
this.textElement_.textContent = this.message_;
|
||||
this.element_.classList.add(this.cssClasses_.ACTIVE);
|
||||
this.element_.setAttribute('aria-hidden', 'false');
|
||||
setTimeout(this.cleanup_.bind(this), this.timeout_);
|
||||
this.timeoutID_ = setTimeout(this.cleanup_.bind(this), this.timeout_);
|
||||
|
||||
};
|
||||
|
||||
@ -127,7 +128,21 @@
|
||||
}
|
||||
};
|
||||
MaterialSnackbar.prototype['showSnackbar'] = MaterialSnackbar.prototype.showSnackbar;
|
||||
|
||||
/**
|
||||
* Hide the snackbar.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
MaterialSnackbar.prototype.hideSnackbar = function() {
|
||||
if (!this.active) {
|
||||
return;
|
||||
}
|
||||
if (typeof this.timeoutID_ === 'number') {
|
||||
clearTimeout(this.timeoutID_);
|
||||
this.cleanup_();
|
||||
}
|
||||
};
|
||||
MaterialSnackbar.prototype['hideSnackbar'] = MaterialSnackbar.prototype.hideSnackbar;
|
||||
/**
|
||||
* Check if the queue has items within it.
|
||||
* If it does, display the next entry.
|
||||
@ -158,6 +173,7 @@
|
||||
this.actionHandler_ = undefined;
|
||||
this.message_ = undefined;
|
||||
this.actionText_ = undefined;
|
||||
this.timeoutID_ = undefined;
|
||||
this.active = false;
|
||||
this.checkQueue_();
|
||||
}.bind(this), /** @type {number} */ (this.Constant_.ANIMATION_LENGTH));
|
||||
|
Loading…
Reference in New Issue
Block a user