add .type on Notification and Message

This commit is contained in:
Leopoldthecoder
2016-10-04 17:33:32 +08:00
committed by cinwell.li
parent 805e8fc112
commit 3d60efd468
5 changed files with 39 additions and 24 deletions

View File

@@ -32,6 +32,18 @@ var Notification = function(options) {
instances.push(instance);
};
['success', 'warning', 'info', 'error'].forEach(type => {
Notification[type] = options => {
if (typeof options === 'string') {
options = {
message: options
};
}
options.type = type;
return Notification(options);
};
});
Notification.close = function(id, userOnClose) {
let index;
let removedHeight;