Files
talk/client/coral-framework/services/notification.js
T
2017-09-04 23:55:44 +07:00

19 lines
525 B
JavaScript

/**
* createNotificationService returns a notification services based on pym.
* @param {Object} pym
* @return {Object} notification service
*/
export function createNotificationService(pym) {
return {
success(text) {
pym.sendMessage('coral-alert', JSON.stringify({kind: 'success', text}));
},
error(text) {
pym.sendMessage('coral-alert', JSON.stringify({kind: 'error', text}));
},
info(text) {
pym.sendMessage('coral-alert', JSON.stringify({kind: 'info', text}));
},
};
}