Built motion from commit (unavailable).|2.5.4
[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 _0xb145=['exports','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3abc65,_0x3a195e){var _0x5f489c=function(_0x2ac2bc){while(--_0x2ac2bc){_0x3abc65['push'](_0x3abc65['shift']());}};_0x5f489c(++_0x3a195e);}(_0xb145,0xa3));var _0x5b14=function(_0x24286f,_0x3007c6){_0x24286f=_0x24286f-0x0;var _0x32aff4=_0xb145[_0x24286f];return _0x32aff4;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x5b14('0x0'))['db'][_0x5b14('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x5b14('0x2')](0x0);var events={'afterCreate':_0x5b14('0x3'),'afterUpdate':_0x5b14('0x4'),'afterDestroy':_0x5b14('0x5')};function emitEvent(_0x31f6f0){return function(_0x34b4cd,_0x5111cd,_0x1e0b5b){PluginEvents[_0x5b14('0x6')](_0x31f6f0+':'+_0x34b4cd['id'],_0x34b4cd);PluginEvents[_0x5b14('0x6')](_0x31f6f0,_0x34b4cd);_0x1e0b5b(null);};}for(var e in events){if(events[_0x5b14('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x5b14('0x8')]=PluginEvents;