49886a3817100890690cc19da5fd8f294c41ea85
[motion2.git] / server / api / notification / notification.events.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Notification','setMaxListeners','save','update'];(function(_0x2046e4,_0x590a65){var _0x5e0a6c=function(_0xfcfb7a){while(--_0xfcfb7a){_0x2046e4['push'](_0x2046e4['shift']());}};_0x5e0a6c(++_0x590a65);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5dfe2f,_0x50d958){_0x5dfe2f=_0x5dfe2f-0x0;var _0x268dec=_0x5f2f[_0x5dfe2f];return _0x268dec;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var Notification=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){NotificationEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);NotificationEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];Notification[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=NotificationEvents;