cd296f6d33f3cfac7659e59fd1965baa81ab3140
[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 _0x5b5a=['emit','hasOwnProperty','hook','../../mysqldb','Plugin','save','update','remove'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5b5a,0xc3));var _0xa5b5=function(_0xe08054,_0x22c584){_0xe08054=_0xe08054-0x0;var _0x5c3e9d=_0x5b5a[_0xe08054];return _0x5c3e9d;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xa5b5('0x0'))['db'][_0xa5b5('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa5b5('0x2'),'afterUpdate':_0xa5b5('0x3'),'afterDestroy':_0xa5b5('0x4')};function emitEvent(_0x1b4884){return function(_0x1c76ae,_0x45f433,_0x1b87bf){PluginEvents[_0xa5b5('0x5')](_0x1b4884+':'+_0x1c76ae['id'],_0x1c76ae);PluginEvents['emit'](_0x1b4884,_0x1c76ae);_0x1b87bf(null);};}for(var e in events){if(events[_0xa5b5('0x6')](e)){var event=events[e];Plugin[_0xa5b5('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents;