18161833c3abf0d2db325205865249cb0bb82bfb
[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 _0x4d87=['../../mysqldb','Plugin','setMaxListeners','update','remove','emit'];(function(_0x2a6b55,_0x572485){var _0x3dd7fd=function(_0x52837f){while(--_0x52837f){_0x2a6b55['push'](_0x2a6b55['shift']());}};_0x3dd7fd(++_0x572485);}(_0x4d87,0xf0));var _0x74d8=function(_0x59ecaa,_0x8bc20a){_0x59ecaa=_0x59ecaa-0x0;var _0x22ddb0=_0x4d87[_0x59ecaa];return _0x22ddb0;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x74d8('0x0'))['db'][_0x74d8('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x74d8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x74d8('0x3'),'afterDestroy':_0x74d8('0x4')};function emitEvent(_0x586bed){return function(_0x58792b,_0x391023,_0x1ec453){PluginEvents[_0x74d8('0x5')](_0x586bed+':'+_0x58792b['id'],_0x58792b);PluginEvents[_0x74d8('0x5')](_0x586bed,_0x58792b);_0x1ec453(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents;