d12a89e87717cd2f18406a32bb1f0b89c398a18f
[motion2.git] / server / api / dashboardItem / dashboardItem.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 _0xa9f6=['exports','events','DashboardItem','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x19441c,_0x4a6465){var _0xa57086=function(_0x2aabd0){while(--_0x2aabd0){_0x19441c['push'](_0x19441c['shift']());}};_0xa57086(++_0x4a6465);}(_0xa9f6,0x14e));var _0x6a9f=function(_0x5042f5,_0x42fdb3){_0x5042f5=_0x5042f5-0x0;var _0x5b0760=_0xa9f6[_0x5042f5];return _0x5b0760;};'use strict';var EventEmitter=require(_0x6a9f('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x6a9f('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x6a9f('0x2')](0x0);var events={'afterCreate':_0x6a9f('0x3'),'afterUpdate':'update','afterDestroy':_0x6a9f('0x4')};function emitEvent(_0x49d4f2){return function(_0x1bbdc2,_0x31f05e,_0x33b04f){DashboardItemEvents[_0x6a9f('0x5')](_0x49d4f2+':'+_0x1bbdc2['id'],_0x1bbdc2);DashboardItemEvents['emit'](_0x49d4f2,_0x1bbdc2);_0x33b04f(null);};}for(var e in events){if(events[_0x6a9f('0x6')](e)){var event=events[e];DashboardItem[_0x6a9f('0x7')](e,emitEvent(event));}}module[_0x6a9f('0x8')]=DashboardItemEvents;