9bc0831ff8463f18356d3aa100734e4841cdcb7b
[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 _0x955f=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x49dfc9,_0x517048){var _0x440452=function(_0x51d516){while(--_0x51d516){_0x49dfc9['push'](_0x49dfc9['shift']());}};_0x440452(++_0x517048);}(_0x955f,0x1eb));var _0xf955=function(_0x17b370,_0x5dc906){_0x17b370=_0x17b370-0x0;var _0x54b280=_0x955f[_0x17b370];return _0x54b280;};'use strict';var EventEmitter=require(_0xf955('0x0'));var Plugin=require(_0xf955('0x1'))['db'][_0xf955('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xf955('0x3')](0x0);var events={'afterCreate':_0xf955('0x4'),'afterUpdate':'update','afterDestroy':_0xf955('0x5')};function emitEvent(_0x5655ef){return function(_0x5d0c95,_0x1db0dd,_0x5a20bc){PluginEvents[_0xf955('0x6')](_0x5655ef+':'+_0x5d0c95['id'],_0x5d0c95);PluginEvents[_0xf955('0x6')](_0x5655ef,_0x5d0c95);_0x5a20bc(null);};}for(var e in events){if(events[_0xf955('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xf955('0x8')]=PluginEvents;