73b83edccac1f92ea41c6d9af9885e128fba00ef
[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 _0x36c3=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2e0342,_0x2bae01){var _0xe38517=function(_0x427432){while(--_0x427432){_0x2e0342['push'](_0x2e0342['shift']());}};_0xe38517(++_0x2bae01);}(_0x36c3,0x1a6));var _0x336c=function(_0x3b59ed,_0x281a70){_0x3b59ed=_0x3b59ed-0x0;var _0x5cf829=_0x36c3[_0x3b59ed];return _0x5cf829;};'use strict';var EventEmitter=require(_0x336c('0x0'));var Plugin=require(_0x336c('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x336c('0x2')](0x0);var events={'afterCreate':_0x336c('0x3'),'afterUpdate':_0x336c('0x4'),'afterDestroy':_0x336c('0x5')};function emitEvent(_0x32aed2){return function(_0x2b1194,_0x39ed12,_0x4e4c07){PluginEvents[_0x336c('0x6')](_0x32aed2+':'+_0x2b1194['id'],_0x2b1194);PluginEvents[_0x336c('0x6')](_0x32aed2,_0x2b1194);_0x4e4c07(null);};}for(var e in events){if(events[_0x336c('0x7')](e)){var event=events[e];Plugin[_0x336c('0x8')](e,emitEvent(event));}}module[_0x336c('0x9')]=PluginEvents;