baa9195ebd8385dcfd760aa8892452d49e3392a6
[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 _0xf405=['save','update','emit','hook','exports','events','CmList'];(function(_0x46f2ee,_0x733c62){var _0xff5e7a=function(_0x220c13){while(--_0x220c13){_0x46f2ee['push'](_0x46f2ee['shift']());}};_0xff5e7a(++_0x733c62);}(_0xf405,0xc9));var _0x5f40=function(_0x1c2585,_0x57976d){_0x1c2585=_0x1c2585-0x0;var _0x1d9d6d=_0xf405[_0x1c2585];return _0x1d9d6d;};'use strict';var EventEmitter=require(_0x5f40('0x0'));var CmList=require('../../mysqldb')['db'][_0x5f40('0x1')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5f40('0x2'),'afterUpdate':_0x5f40('0x3'),'afterDestroy':'remove'};function emitEvent(_0x276ff8){return function(_0x5610e7,_0x52faec,_0x1b509a){CmListEvents['emit'](_0x276ff8+':'+_0x5610e7['id'],_0x5610e7);CmListEvents[_0x5f40('0x4')](_0x276ff8,_0x5610e7);_0x1b509a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x5f40('0x5')](e,emitEvent(event));}}module[_0x5f40('0x6')]=CmListEvents;