mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 09:35:10 +01:00
19 lines
603 B
JavaScript
19 lines
603 B
JavaScript
'use strict';
|
|
|
|
export default class GlobalNotificationModel {
|
|
constructor(message, type = 'info', dismissAfter = 5000) {
|
|
if(message) {
|
|
this.message = message;
|
|
} else {
|
|
throw new Error('A notifications message must be defined.');
|
|
}
|
|
|
|
if(type === 'info' || type === 'success' || type === 'warning' || type === 'danger') {
|
|
this.type = type;
|
|
} else {
|
|
throw new Error('A notification\'s type either has to be info, success, warning, danger. Not: ' + type);
|
|
}
|
|
|
|
this.dismissAfter = dismissAfter;
|
|
}
|
|
} |