mirror of
https://github.com/google/material-design-lite.git
synced 2024-09-11 12:25:38 +03:00
Add Snackbar hide method
This commit is contained in:
parent
fd21836fd4
commit
03120bb944
@ -38,6 +38,7 @@
|
|||||||
this.actionHandler_ = undefined;
|
this.actionHandler_ = undefined;
|
||||||
this.message_ = undefined;
|
this.message_ = undefined;
|
||||||
this.actionText_ = undefined;
|
this.actionText_ = undefined;
|
||||||
|
this.timeoutID_ = undefined;
|
||||||
this.queuedNotifications_ = [];
|
this.queuedNotifications_ = [];
|
||||||
this.setActionHidden_(true);
|
this.setActionHidden_(true);
|
||||||
};
|
};
|
||||||
@ -86,7 +87,7 @@
|
|||||||
this.textElement_.textContent = this.message_;
|
this.textElement_.textContent = this.message_;
|
||||||
this.element_.classList.add(this.cssClasses_.ACTIVE);
|
this.element_.classList.add(this.cssClasses_.ACTIVE);
|
||||||
this.element_.setAttribute('aria-hidden', 'false');
|
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;
|
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.
|
* Check if the queue has items within it.
|
||||||
* If it does, display the next entry.
|
* If it does, display the next entry.
|
||||||
@ -158,6 +173,7 @@
|
|||||||
this.actionHandler_ = undefined;
|
this.actionHandler_ = undefined;
|
||||||
this.message_ = undefined;
|
this.message_ = undefined;
|
||||||
this.actionText_ = undefined;
|
this.actionText_ = undefined;
|
||||||
|
this.timeoutID_ = undefined;
|
||||||
this.active = false;
|
this.active = false;
|
||||||
this.checkQueue_();
|
this.checkQueue_();
|
||||||
}.bind(this), /** @type {number} */ (this.Constant_.ANIMATION_LENGTH));
|
}.bind(this), /** @type {number} */ (this.Constant_.ANIMATION_LENGTH));
|
||||||
|
Loading…
Reference in New Issue
Block a user