252d0149d8f085e2ee6899f34c06b712d1b5e1df
[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 _0x73c7=['emit','hook','exports','events','../../mysqldb','CmContact','save','update','remove'];(function(_0x2abe8c,_0x2e02ee){var _0x533664=function(_0x1de8b8){while(--_0x1de8b8){_0x2abe8c['push'](_0x2abe8c['shift']());}};_0x533664(++_0x2e02ee);}(_0x73c7,0x1a1));var _0x773c=function(_0x36ff8d,_0x18eedd){_0x36ff8d=_0x36ff8d-0x0;var _0x91f5a9=_0x73c7[_0x36ff8d];return _0x91f5a9;};'use strict';var EventEmitter=require(_0x773c('0x0'));var CmContact=require(_0x773c('0x1'))['db'][_0x773c('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x773c('0x3'),'afterUpdate':_0x773c('0x4'),'afterDestroy':_0x773c('0x5')};function emitEvent(_0x18777d){return function(_0x2bfeec,_0x1a962f,_0x235241){CmContactEvents[_0x773c('0x6')](_0x18777d+':'+_0x2bfeec['id'],_0x2bfeec);CmContactEvents['emit'](_0x18777d,_0x2bfeec);_0x235241(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x773c('0x7')](e,emitEvent(event));}}module[_0x773c('0x8')]=CmContactEvents;