61892effd950e8cd7d7e1788dabe52fd9fbb79fd
[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(_0x441aa9,_0x40d6a6){var _0x425d6a=function(_0x54b91a){while(--_0x54b91a){_0x441aa9['push'](_0x441aa9['shift']());}};_0x425d6a(++_0x40d6a6);}(_0x2a07,0x74));var _0x72a0=function(_0x2d7ec6,_0x9f52e6){_0x2d7ec6=_0x2d7ec6-0x0;var _0x50c714=_0x2a07[_0x2d7ec6];return _0x50c714;};'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;