211577449ede356741f7750d5bd246d56b5786b9
[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 _0x7e02=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit'];(function(_0x2dec17,_0x5351d7){var _0x18d8e1=function(_0x47f678){while(--_0x47f678){_0x2dec17['push'](_0x2dec17['shift']());}};_0x18d8e1(++_0x5351d7);}(_0x7e02,0x71));var _0x27e0=function(_0x1d0b20,_0x15898a){_0x1d0b20=_0x1d0b20-0x0;var _0x563b0d=_0x7e02[_0x1d0b20];return _0x563b0d;};'use strict';var EventEmitter=require(_0x27e0('0x0'));var Plugin=require(_0x27e0('0x1'))['db'][_0x27e0('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x27e0('0x3')](0x0);var events={'afterCreate':_0x27e0('0x4'),'afterUpdate':_0x27e0('0x5'),'afterDestroy':_0x27e0('0x6')};function emitEvent(_0x57d7fb){return function(_0x4fa613,_0x3d4f41,_0x5abeff){PluginEvents[_0x27e0('0x7')](_0x57d7fb+':'+_0x4fa613['id'],_0x4fa613);PluginEvents[_0x27e0('0x7')](_0x57d7fb,_0x4fa613);_0x5abeff(null);};}for(var e in events){if(events[_0x27e0('0x8')](e)){var event=events[e];Plugin[_0x27e0('0x9')](e,emitEvent(event));}}module[_0x27e0('0xa')]=PluginEvents;