191f102ed4c0eccbafb424f87d069e8ecde44a08
[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 _0x5e0c=['Plugin','setMaxListeners','save','update','remove','emit','exports','../../mysqldb'];(function(_0x8f2981,_0xd648d6){var _0x2cde7b=function(_0x684c25){while(--_0x684c25){_0x8f2981['push'](_0x8f2981['shift']());}};_0x2cde7b(++_0xd648d6);}(_0x5e0c,0x19f));var _0xc5e0=function(_0xf1af27,_0x598bb1){_0xf1af27=_0xf1af27-0x0;var _0x46b274=_0x5e0c[_0xf1af27];return _0x46b274;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xc5e0('0x0'))['db'][_0xc5e0('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xc5e0('0x2')](0x0);var events={'afterCreate':_0xc5e0('0x3'),'afterUpdate':_0xc5e0('0x4'),'afterDestroy':_0xc5e0('0x5')};function emitEvent(_0x4adda8){return function(_0x60c6c3,_0x108ea2,_0x43f754){PluginEvents[_0xc5e0('0x6')](_0x4adda8+':'+_0x60c6c3['id'],_0x60c6c3);PluginEvents[_0xc5e0('0x6')](_0x4adda8,_0x60c6c3);_0x43f754(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xc5e0('0x7')]=PluginEvents;