Built motion from commit dc14b02d.|2.6.27
[motion2.git] / server / api / cmContact / cmContact.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 _0xc932=['remove','emit','hasOwnProperty','events','../../mysqldb','CmContact','setMaxListeners','save'];(function(_0x5b5232,_0x48f82f){var _0x33dfa5=function(_0x278c5e){while(--_0x278c5e){_0x5b5232['push'](_0x5b5232['shift']());}};_0x33dfa5(++_0x48f82f);}(_0xc932,0x93));var _0x2c93=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc932[_0x46698a];return _0x356db0;};'use strict';var EventEmitter=require(_0x2c93('0x0'));var CmContact=require(_0x2c93('0x1'))['db'][_0x2c93('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x2c93('0x3')](0x0);var events={'afterCreate':_0x2c93('0x4'),'afterUpdate':'update','afterDestroy':_0x2c93('0x5')};function emitEvent(_0x6bd3d9){return function(_0x9c0121,_0x5ae451,_0x4506db){CmContactEvents[_0x2c93('0x6')](_0x6bd3d9+':'+_0x9c0121['id'],_0x9c0121);CmContactEvents[_0x2c93('0x6')](_0x6bd3d9,_0x9c0121);_0x4506db(null);};}for(var e in events){if(events[_0x2c93('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module['exports']=CmContactEvents;