Built motion from commit 87cd5f02.|2.5.48
[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 _0xae35=['events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x2d0818,_0x16d1a9){var _0x466400=function(_0x3955d1){while(--_0x3955d1){_0x2d0818['push'](_0x2d0818['shift']());}};_0x466400(++_0x16d1a9);}(_0xae35,0x172));var _0x5ae3=function(_0xcf73fc,_0x2e014c){_0xcf73fc=_0xcf73fc-0x0;var _0x9c8c72=_0xae35[_0xcf73fc];return _0x9c8c72;};'use strict';var EventEmitter=require(_0x5ae3('0x0'));var Plugin=require(_0x5ae3('0x1'))['db'][_0x5ae3('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x5ae3('0x3')](0x0);var events={'afterCreate':_0x5ae3('0x4'),'afterUpdate':_0x5ae3('0x5'),'afterDestroy':_0x5ae3('0x6')};function emitEvent(_0x39d9b7){return function(_0x54c0f2,_0x6dffe3,_0x4d1536){PluginEvents[_0x5ae3('0x7')](_0x39d9b7+':'+_0x54c0f2['id'],_0x54c0f2);PluginEvents[_0x5ae3('0x7')](_0x39d9b7,_0x54c0f2);_0x4d1536(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x5ae3('0x8')](e,emitEvent(event));}}module[_0x5ae3('0x9')]=PluginEvents;