You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
notification/src/notificationStore.js

52 lines
909 B

import observable from '@riotjs/observable'
/**
* NotificationService
*
* @author Björn Hase
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://gitea.node001.net/tiny-components/notification
*
*/
export default observable({
SUCCESS: 'success',
DANGER: 'danger',
INFO: 'info',
/**
* adding success notification
*
*/
success(message) {
this._add(message, this.SUCCESS)
},
/**
*
*
*/
danger(message) {
this._add(message, this.DANGER)
},
/**
*
*
*/
info(message) {
this._add(message, this.INFO)
},
/**
*
* @param {[type]} message [description]
* @param {[type]} type [description]
*/
_add(message, type) {
this.trigger('append', {
message: message,
type: type
})
}
})