Built motion from commit 14588770.|2.5.38
[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 _0x7dee=['remove','emit','hasOwnProperty','hook','exports','events','Plugin','save','update'];(function(_0x37ffc6,_0x251b7f){var _0x47faac=function(_0x2c8090){while(--_0x2c8090){_0x37ffc6['push'](_0x37ffc6['shift']());}};_0x47faac(++_0x251b7f);}(_0x7dee,0xb0));var _0xe7de=function(_0x50f7ac,_0x13c3fe){_0x50f7ac=_0x50f7ac-0x0;var _0x577434=_0x7dee[_0x50f7ac];return _0x577434;};'use strict';var EventEmitter=require(_0xe7de('0x0'));var Plugin=require('../../mysqldb')['db'][_0xe7de('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe7de('0x2'),'afterUpdate':_0xe7de('0x3'),'afterDestroy':_0xe7de('0x4')};function emitEvent(_0x168aff){return function(_0x4b846b,_0x12be83,_0x544df8){PluginEvents[_0xe7de('0x5')](_0x168aff+':'+_0x4b846b['id'],_0x4b846b);PluginEvents[_0xe7de('0x5')](_0x168aff,_0x4b846b);_0x544df8(null);};}for(var e in events){if(events[_0xe7de('0x6')](e)){var event=events[e];Plugin[_0xe7de('0x7')](e,emitEvent(event));}}module[_0xe7de('0x8')]=PluginEvents;