83b01972ca8191ce5ab1349b40d55d0df093fd2a
[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 _0x8e3f=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','Plugin','save','update'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e3f[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0xf8e3('0x0'));var Plugin=require(_0xf8e3('0x1'))['db'][_0xf8e3('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf8e3('0x3'),'afterUpdate':_0xf8e3('0x4'),'afterDestroy':_0xf8e3('0x5')};function emitEvent(_0x598e9c){return function(_0x15d6ea,_0x41bc05,_0x4dab56){PluginEvents[_0xf8e3('0x6')](_0x598e9c+':'+_0x15d6ea['id'],_0x15d6ea);PluginEvents[_0xf8e3('0x6')](_0x598e9c,_0x15d6ea);_0x4dab56(null);};}for(var e in events){if(events[_0xf8e3('0x7')](e)){var event=events[e];Plugin[_0xf8e3('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents;