561dadc197cf79e67eed2f20a4e21ac512c7278c
[motion2.git] / server / api / plugin / plugin.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 _0x5a43=['../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2eeae9,_0x3bdcdf){var _0x79d3c2=function(_0x50e10e){while(--_0x50e10e){_0x2eeae9['push'](_0x2eeae9['shift']());}};_0x79d3c2(++_0x3bdcdf);}(_0x5a43,0xf1));var _0x35a4=function(_0x4a7d1a,_0x4e3110){_0x4a7d1a=_0x4a7d1a-0x0;var _0x20071b=_0x5a43[_0x4a7d1a];return _0x20071b;};'use strict';var EventEmitter=require(_0x35a4('0x0'));var Plugin=require(_0x35a4('0x1'))['db'][_0x35a4('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x35a4('0x3')](0x0);var events={'afterCreate':_0x35a4('0x4'),'afterUpdate':_0x35a4('0x5'),'afterDestroy':_0x35a4('0x6')};function emitEvent(_0x51ec31){return function(_0x502fbd,_0x542219,_0x59ff38){PluginEvents[_0x35a4('0x7')](_0x51ec31+':'+_0x502fbd['id'],_0x502fbd);PluginEvents[_0x35a4('0x7')](_0x51ec31,_0x502fbd);_0x59ff38(null);};}for(var e in events){if(events[_0x35a4('0x8')](e)){var event=events[e];Plugin[_0x35a4('0x9')](e,emitEvent(event));}}module[_0x35a4('0xa')]=PluginEvents;