Files
talk/client/coral-framework/services/notification.js
T
2018-01-11 20:00:34 -07:00

19 lines
531 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 }));
},
};
}