73da4ff7943ac441728c936f56b20bd0a554833f
[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 _0x2a07=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x891dd4,_0x38fac0){var _0x2425de=function(_0xa3ea7){while(--_0xa3ea7){_0x891dd4['push'](_0x891dd4['shift']());}};_0x2425de(++_0x38fac0);}(_0x2a07,0x74));var _0x72a0=function(_0x44ea17,_0x422059){_0x44ea17=_0x44ea17-0x0;var _0x1d8af1=_0x2a07[_0x44ea17];return _0x1d8af1;};'use strict';var EventEmitter=require(_0x72a0('0x0'));var Plugin=require(_0x72a0('0x1'))['db'][_0x72a0('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x72a0('0x3')](0x0);var events={'afterCreate':_0x72a0('0x4'),'afterUpdate':'update','afterDestroy':_0x72a0('0x5')};function emitEvent(_0x5f7f29){return function(_0x135982,_0x45b155,_0x431f65){PluginEvents[_0x72a0('0x6')](_0x5f7f29+':'+_0x135982['id'],_0x135982);PluginEvents[_0x72a0('0x6')](_0x5f7f29,_0x135982);_0x431f65(null);};}for(var e in events){if(events[_0x72a0('0x7')](e)){var event=events[e];Plugin[_0x72a0('0x8')](e,emitEvent(event));}}module[_0x72a0('0x9')]=PluginEvents;