Built motion from commit 25580385.|2.6.2
[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 _0x36bb=['events','../../mysqldb','Plugin','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x390856,_0x37b469){var _0x52a4e5=function(_0x66c693){while(--_0x66c693){_0x390856['push'](_0x390856['shift']());}};_0x52a4e5(++_0x37b469);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xb36b('0x0'));var Plugin=require(_0xb36b('0x1'))['db'][_0xb36b('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb36b('0x3'),'afterUpdate':_0xb36b('0x4'),'afterDestroy':_0xb36b('0x5')};function emitEvent(_0x4003b8){return function(_0x311671,_0x3d57d7,_0x2bcc68){PluginEvents[_0xb36b('0x6')](_0x4003b8+':'+_0x311671['id'],_0x311671);PluginEvents[_0xb36b('0x6')](_0x4003b8,_0x311671);_0x2bcc68(null);};}for(var e in events){if(events[_0xb36b('0x7')](e)){var event=events[e];Plugin[_0xb36b('0x8')](e,emitEvent(event));}}module[_0xb36b('0x9')]=PluginEvents;