2f8a46d3f4560718042717d2226b563d4058371f
[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 _0xd819=['exports','../../mysqldb','Plugin','setMaxListeners','save','remove','emit','hook'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xd819,0x181));var _0x9d81=function(_0xe2bb9e,_0x2629a9){_0xe2bb9e=_0xe2bb9e-0x0;var _0x43ba10=_0xd819[_0xe2bb9e];return _0x43ba10;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x9d81('0x0'))['db'][_0x9d81('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x9d81('0x2')](0x0);var events={'afterCreate':_0x9d81('0x3'),'afterUpdate':'update','afterDestroy':_0x9d81('0x4')};function emitEvent(_0x5591a5){return function(_0x301265,_0x53ff09,_0x382cc1){PluginEvents[_0x9d81('0x5')](_0x5591a5+':'+_0x301265['id'],_0x301265);PluginEvents[_0x9d81('0x5')](_0x5591a5,_0x301265);_0x382cc1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x9d81('0x6')](e,emitEvent(event));}}module[_0x9d81('0x7')]=PluginEvents;