2855756ac1043ff3c1f20238b26a74545a173f63
[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 _0x3e63=['events','../../mysqldb','CmContact','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x70fd53,_0x2a95a6){var _0x4b71c5=function(_0x4b349d){while(--_0x4b349d){_0x70fd53['push'](_0x70fd53['shift']());}};_0x4b71c5(++_0x2a95a6);}(_0x3e63,0x1cc));var _0x33e6=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0x3e63[_0x3b4b1d];return _0x488c36;};'use strict';var EventEmitter=require(_0x33e6('0x0'));var CmContact=require(_0x33e6('0x1'))['db'][_0x33e6('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x33e6('0x3'),'afterUpdate':_0x33e6('0x4'),'afterDestroy':_0x33e6('0x5')};function emitEvent(_0x5c9112){return function(_0x3a1c35,_0x2adede,_0x523e07){CmContactEvents['emit'](_0x5c9112+':'+_0x3a1c35['id'],_0x3a1c35);CmContactEvents[_0x33e6('0x6')](_0x5c9112,_0x3a1c35);_0x523e07(null);};}for(var e in events){if(events[_0x33e6('0x7')](e)){var event=events[e];CmContact[_0x33e6('0x8')](e,emitEvent(event));}}module[_0x33e6('0x9')]=CmContactEvents;