Built motion from commit 43538d75.|2.5.35
[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 _0x4753=['update','emit','hasOwnProperty','exports','events','../../mysqldb','Plugin','save'];(function(_0x31623f,_0x55c1ca){var _0x4d2820=function(_0x2a2c5f){while(--_0x2a2c5f){_0x31623f['push'](_0x31623f['shift']());}};_0x4d2820(++_0x55c1ca);}(_0x4753,0x1f4));var _0x3475=function(_0x1d9cb0,_0x3622c3){_0x1d9cb0=_0x1d9cb0-0x0;var _0x5b6dd6=_0x4753[_0x1d9cb0];return _0x5b6dd6;};'use strict';var EventEmitter=require(_0x3475('0x0'));var Plugin=require(_0x3475('0x1'))['db'][_0x3475('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3475('0x3'),'afterUpdate':_0x3475('0x4'),'afterDestroy':'remove'};function emitEvent(_0x212d98){return function(_0x4c6fd2,_0x5a801b,_0x5de37e){PluginEvents['emit'](_0x212d98+':'+_0x4c6fd2['id'],_0x4c6fd2);PluginEvents[_0x3475('0x5')](_0x212d98,_0x4c6fd2);_0x5de37e(null);};}for(var e in events){if(events[_0x3475('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x3475('0x7')]=PluginEvents;