mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
22 lines
636 B
JavaScript
22 lines
636 B
JavaScript
'use strict';
|
|
|
|
export default class GlobalNotificationModel {
|
|
constructor(message, type = 'success', dismissAfter = 5000) {
|
|
if (type !== 'success' && type !== 'danger') {
|
|
throw new Error(`A notification's type either has to be success, or danger. Not: ${type}`);
|
|
}
|
|
|
|
if (message) {
|
|
this.message = message;
|
|
} else {
|
|
console.logGlobal(new Error('Global notification did not contain a message and was ignored'), {
|
|
dismissAfter,
|
|
type
|
|
});
|
|
}
|
|
|
|
this.dismissAfter = dismissAfter;
|
|
this.type = type;
|
|
}
|
|
}
|