926372bed3a668d2613cc12c6ebbc96e0310c75c
[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 _0xcf2f=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x524621,_0x6595c){var _0x228276=function(_0x3514e6){while(--_0x3514e6){_0x524621['push'](_0x524621['shift']());}};_0x228276(++_0x6595c);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x390fea,_0x25a6ed){_0x390fea=_0x390fea-0x0;var _0x412196=_0xcf2f[_0x390fea];return _0x412196;};'use strict';var EventEmitter=require(_0xfcf2('0x0'));var Plugin=require(_0xfcf2('0x1'))['db'][_0xfcf2('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xfcf2('0x3')](0x0);var events={'afterCreate':_0xfcf2('0x4'),'afterUpdate':'update','afterDestroy':_0xfcf2('0x5')};function emitEvent(_0x12ddf5){return function(_0x1e3661,_0x34bcaf,_0x179e60){PluginEvents[_0xfcf2('0x6')](_0x12ddf5+':'+_0x1e3661['id'],_0x1e3661);PluginEvents[_0xfcf2('0x6')](_0x12ddf5,_0x1e3661);_0x179e60(null);};}for(var e in events){if(events[_0xfcf2('0x7')](e)){var event=events[e];Plugin[_0xfcf2('0x8')](e,emitEvent(event));}}module[_0xfcf2('0x9')]=PluginEvents;