Built motion from commit (unavailable).|2.5.4
[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 _0x0e43=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners'];(function(_0x5e2881,_0xf51b9b){var _0x1a8888=function(_0x4a552c){while(--_0x4a552c){_0x5e2881['push'](_0x5e2881['shift']());}};_0x1a8888(++_0xf51b9b);}(_0x0e43,0x1f0));var _0x30e4=function(_0x4af252,_0x2da7e2){_0x4af252=_0x4af252-0x0;var _0x259b19=_0x0e43[_0x4af252];return _0x259b19;};'use strict';var EventEmitter=require(_0x30e4('0x0'));var CmContact=require(_0x30e4('0x1'))['db'][_0x30e4('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x30e4('0x3')](0x0);var events={'afterCreate':_0x30e4('0x4'),'afterUpdate':_0x30e4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x23071e){return function(_0x5c909a,_0x3e14d5,_0x30b9e1){CmContactEvents[_0x30e4('0x6')](_0x23071e+':'+_0x5c909a['id'],_0x5c909a);CmContactEvents[_0x30e4('0x6')](_0x23071e,_0x5c909a);_0x30b9e1(null);};}for(var e in events){if(events[_0x30e4('0x7')](e)){var event=events[e];CmContact[_0x30e4('0x8')](e,emitEvent(event));}}module[_0x30e4('0x9')]=CmContactEvents;