f0c908672d8413511e8c65bc4ca2b9f332f23950
[motion2.git] / server / api / cmList / cmList.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 _0xb9c2=['exports','events','../../mysqldb','CmList','setMaxListeners','emit','hook'];(function(_0xbbd879,_0x3ca2de){var _0x154e5c=function(_0x12ed54){while(--_0x12ed54){_0xbbd879['push'](_0xbbd879['shift']());}};_0x154e5c(++_0x3ca2de);}(_0xb9c2,0x182));var _0x2b9c=function(_0x38ed42,_0x3d9a37){_0x38ed42=_0x38ed42-0x0;var _0x474931=_0xb9c2[_0x38ed42];return _0x474931;};'use strict';var EventEmitter=require(_0x2b9c('0x0'));var CmList=require(_0x2b9c('0x1'))['db'][_0x2b9c('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x2b9c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x89e260){return function(_0x43890f,_0x4161d2,_0x3b73ef){CmListEvents[_0x2b9c('0x4')](_0x89e260+':'+_0x43890f['id'],_0x43890f);CmListEvents[_0x2b9c('0x4')](_0x89e260,_0x43890f);_0x3b73ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x2b9c('0x5')](e,emitEvent(event));}}module[_0x2b9c('0x6')]=CmListEvents;