Built motion from commit f7863d46.|2.5.41
[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 _0x2d78=['../../mysqldb','Plugin','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5734d5,_0x14f665){var _0x3db21e=function(_0x2cca23){while(--_0x2cca23){_0x5734d5['push'](_0x5734d5['shift']());}};_0x3db21e(++_0x14f665);}(_0x2d78,0x199));var _0x82d7=function(_0x1ceb7b,_0x894d3d){_0x1ceb7b=_0x1ceb7b-0x0;var _0x57c016=_0x2d78[_0x1ceb7b];return _0x57c016;};'use strict';var EventEmitter=require(_0x82d7('0x0'));var Plugin=require(_0x82d7('0x1'))['db'][_0x82d7('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x82d7('0x3'),'afterUpdate':_0x82d7('0x4'),'afterDestroy':_0x82d7('0x5')};function emitEvent(_0x7f0495){return function(_0x3aed11,_0x23e4d0,_0x13fb9e){PluginEvents[_0x82d7('0x6')](_0x7f0495+':'+_0x3aed11['id'],_0x3aed11);PluginEvents[_0x82d7('0x6')](_0x7f0495,_0x3aed11);_0x13fb9e(null);};}for(var e in events){if(events[_0x82d7('0x7')](e)){var event=events[e];Plugin[_0x82d7('0x8')](e,emitEvent(event));}}module[_0x82d7('0x9')]=PluginEvents;