b464859c5e2bf530d23f68ecf834d64e7deab51f
[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 _0xf31b=['save','update','remove','emit','hook','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x1bf8cc,_0x118778){var _0x322d20=function(_0x36953d){while(--_0x36953d){_0x1bf8cc['push'](_0x1bf8cc['shift']());}};_0x322d20(++_0x118778);}(_0xf31b,0x1a0));var _0xbf31=function(_0x37e31d,_0x1b58f6){_0x37e31d=_0x37e31d-0x0;var _0x28c7fa=_0xf31b[_0x37e31d];return _0x28c7fa;};'use strict';var EventEmitter=require(_0xbf31('0x0'));var Plugin=require(_0xbf31('0x1'))['db'][_0xbf31('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xbf31('0x3')](0x0);var events={'afterCreate':_0xbf31('0x4'),'afterUpdate':_0xbf31('0x5'),'afterDestroy':_0xbf31('0x6')};function emitEvent(_0x5caf83){return function(_0x2a32c2,_0x205975,_0x5c989f){PluginEvents['emit'](_0x5caf83+':'+_0x2a32c2['id'],_0x2a32c2);PluginEvents[_0xbf31('0x7')](_0x5caf83,_0x2a32c2);_0x5c989f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xbf31('0x8')](e,emitEvent(event));}}module[_0xbf31('0x9')]=PluginEvents;