5ee7e8c85eb5ecc4581a225d857db43edb45a5cc
[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 _0x46a6=['setMaxListeners','save','update','emit','hook','exports','events','CmList'];(function(_0x4ddb5a,_0x4ac1e7){var _0x3cc697=function(_0x4de92c){while(--_0x4de92c){_0x4ddb5a['push'](_0x4ddb5a['shift']());}};_0x3cc697(++_0x4ac1e7);}(_0x46a6,0x66));var _0x646a=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x46a6[_0x396466];return _0x5e9ab4;};'use strict';var EventEmitter=require(_0x646a('0x0'));var CmList=require('../../mysqldb')['db'][_0x646a('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x646a('0x2')](0x0);var events={'afterCreate':_0x646a('0x3'),'afterUpdate':_0x646a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21a23a){return function(_0x4e84e5,_0x585e4d,_0x4e330b){CmListEvents[_0x646a('0x5')](_0x21a23a+':'+_0x4e84e5['id'],_0x4e84e5);CmListEvents[_0x646a('0x5')](_0x21a23a,_0x4e84e5);_0x4e330b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x646a('0x6')](e,emitEvent(event));}}module[_0x646a('0x7')]=CmListEvents;