Built motion from commit 10af8726.|2.6.34
[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 _0xf96b=['update','remove','emit','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0x4cfc1d,_0x2c0927){var _0x1c01a0=function(_0x264a74){while(--_0x264a74){_0x4cfc1d['push'](_0x4cfc1d['shift']());}};_0x1c01a0(++_0x2c0927);}(_0xf96b,0x109));var _0xbf96=function(_0x2c6e37,_0x23ffac){_0x2c6e37=_0x2c6e37-0x0;var _0x48e53a=_0xf96b[_0x2c6e37];return _0x48e53a;};'use strict';var EventEmitter=require(_0xbf96('0x0'));var Plugin=require(_0xbf96('0x1'))['db'][_0xbf96('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xbf96('0x3')](0x0);var events={'afterCreate':_0xbf96('0x4'),'afterUpdate':_0xbf96('0x5'),'afterDestroy':_0xbf96('0x6')};function emitEvent(_0x25c3d7){return function(_0x42be7e,_0x38565,_0xab8e7){PluginEvents[_0xbf96('0x7')](_0x25c3d7+':'+_0x42be7e['id'],_0x42be7e);PluginEvents[_0xbf96('0x7')](_0x25c3d7,_0x42be7e);_0xab8e7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xbf96('0x8')](e,emitEvent(event));}}module[_0xbf96('0x9')]=PluginEvents;