Built motion from commit da617fac.|2.6.6
[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 _0xc1dc=['../../mysqldb','Plugin','save','remove','emit','hasOwnProperty','events'];(function(_0x3f5b9a,_0x475e44){var _0x25780b=function(_0xc89ada){while(--_0xc89ada){_0x3f5b9a['push'](_0x3f5b9a['shift']());}};_0x25780b(++_0x475e44);}(_0xc1dc,0x84));var _0xcc1d=function(_0x5aec1d,_0x1f495c){_0x5aec1d=_0x5aec1d-0x0;var _0x3822db=_0xc1dc[_0x5aec1d];return _0x3822db;};'use strict';var EventEmitter=require(_0xcc1d('0x0'));var Plugin=require(_0xcc1d('0x1'))['db'][_0xcc1d('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcc1d('0x3'),'afterUpdate':'update','afterDestroy':_0xcc1d('0x4')};function emitEvent(_0x3f14d6){return function(_0x48011a,_0x14741b,_0x35ffe8){PluginEvents[_0xcc1d('0x5')](_0x3f14d6+':'+_0x48011a['id'],_0x48011a);PluginEvents[_0xcc1d('0x5')](_0x3f14d6,_0x48011a);_0x35ffe8(null);};}for(var e in events){if(events[_0xcc1d('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents;