4e5f8f227a0451fe68b0f53f50bd820ec3db6061
[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 _0xf3a3=['events','../../mysqldb','CmList','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x1e8b26,_0x319e7a){var _0x46a807=function(_0x1b9af8){while(--_0x1b9af8){_0x1e8b26['push'](_0x1e8b26['shift']());}};_0x46a807(++_0x319e7a);}(_0xf3a3,0x144));var _0x3f3a=function(_0x23df25,_0x5ef3be){_0x23df25=_0x23df25-0x0;var _0x59d4ce=_0xf3a3[_0x23df25];return _0x59d4ce;};'use strict';var EventEmitter=require(_0x3f3a('0x0'));var CmList=require(_0x3f3a('0x1'))['db'][_0x3f3a('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3f3a('0x3'),'afterUpdate':_0x3f3a('0x4'),'afterDestroy':_0x3f3a('0x5')};function emitEvent(_0x5bea42){return function(_0x3a5b19,_0x13ff62,_0x1dced4){CmListEvents['emit'](_0x5bea42+':'+_0x3a5b19['id'],_0x3a5b19);CmListEvents['emit'](_0x5bea42,_0x3a5b19);_0x1dced4(null);};}for(var e in events){if(events[_0x3f3a('0x6')](e)){var event=events[e];CmList[_0x3f3a('0x7')](e,emitEvent(event));}}module[_0x3f3a('0x8')]=CmListEvents;