Built motion from commit 9d0783e6.|2.6.13
[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 _0xdeac=['events','update','emit','hook'];(function(_0x38fff7,_0x3d2f6f){var _0x335292=function(_0x2c2470){while(--_0x2c2470){_0x38fff7['push'](_0x38fff7['shift']());}};_0x335292(++_0x3d2f6f);}(_0xdeac,0x108));var _0xcdea=function(_0x38448c,_0xf81883){_0x38448c=_0x38448c-0x0;var _0x441f82=_0xdeac[_0x38448c];return _0x441f82;};'use strict';var EventEmitter=require(_0xcdea('0x0'));var CmContact=require('../../mysqldb')['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xcdea('0x1'),'afterDestroy':'remove'};function emitEvent(_0x561e29){return function(_0x4eb266,_0x34debe,_0x71d53){CmContactEvents[_0xcdea('0x2')](_0x561e29+':'+_0x4eb266['id'],_0x4eb266);CmContactEvents['emit'](_0x561e29,_0x4eb266);_0x71d53(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xcdea('0x3')](e,emitEvent(event));}}module['exports']=CmContactEvents;