Built motion from commit 1fa89557.|2.6.10
[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 _0xc662=['hasOwnProperty','exports','../../mysqldb','CmContact','setMaxListeners','update','emit'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0xc662,0x152));var _0x2c66=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xc662[_0x5c3c0b];return _0x52ecd2;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x2c66('0x0'))['db'][_0x2c66('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x2c66('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2c66('0x3'),'afterDestroy':'remove'};function emitEvent(_0x208f97){return function(_0x9a2eb0,_0x2cf922,_0x5b9301){CmContactEvents['emit'](_0x208f97+':'+_0x9a2eb0['id'],_0x9a2eb0);CmContactEvents[_0x2c66('0x4')](_0x208f97,_0x9a2eb0);_0x5b9301(null);};}for(var e in events){if(events[_0x2c66('0x5')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x2c66('0x6')]=CmContactEvents;