95f2d80097a05bf200a826ff25705c62ea49cfc2
[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 _0xf360=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','save'];(function(_0x1bbda9,_0x5bf0cb){var _0x48080a=function(_0x8c9c07){while(--_0x8c9c07){_0x1bbda9['push'](_0x1bbda9['shift']());}};_0x48080a(++_0x5bf0cb);}(_0xf360,0x9e));var _0x0f36=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xf360[_0x13d07a];return _0x5ee0ee;};'use strict';var EventEmitter=require(_0x0f36('0x0'));var Plugin=require(_0x0f36('0x1'))['db'][_0x0f36('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0f36('0x3'),'afterUpdate':'update','afterDestroy':_0x0f36('0x4')};function emitEvent(_0x2906c1){return function(_0x181766,_0x5e1019,_0x43fb76){PluginEvents[_0x0f36('0x5')](_0x2906c1+':'+_0x181766['id'],_0x181766);PluginEvents[_0x0f36('0x5')](_0x2906c1,_0x181766);_0x43fb76(null);};}for(var e in events){if(events[_0x0f36('0x6')](e)){var event=events[e];Plugin[_0x0f36('0x7')](e,emitEvent(event));}}module[_0x0f36('0x8')]=PluginEvents;