Built motion from commit (unavailable).|2.5.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 _0x15d7=['save','update','emit','hasOwnProperty','exports','events','CmContact','setMaxListeners'];(function(_0x1147fc,_0x42b6d0){var _0x5e7d55=function(_0x232465){while(--_0x232465){_0x1147fc['push'](_0x1147fc['shift']());}};_0x5e7d55(++_0x42b6d0);}(_0x15d7,0x1b5));var _0x715d=function(_0x586b44,_0x1832fe){_0x586b44=_0x586b44-0x0;var _0x51e0c9=_0x15d7[_0x586b44];return _0x51e0c9;};'use strict';var EventEmitter=require(_0x715d('0x0'));var CmContact=require('../../mysqldb')['db'][_0x715d('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x715d('0x2')](0x0);var events={'afterCreate':_0x715d('0x3'),'afterUpdate':_0x715d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2120ed){return function(_0x13c9f3,_0x1fa6e5,_0x4c46fe){CmContactEvents[_0x715d('0x5')](_0x2120ed+':'+_0x13c9f3['id'],_0x13c9f3);CmContactEvents['emit'](_0x2120ed,_0x13c9f3);_0x4c46fe(null);};}for(var e in events){if(events[_0x715d('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x715d('0x7')]=CmContactEvents;