331c658c9812d168580ca09e07aeec1e75a73250
[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 _0x6596=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x140e1e,_0x4b8489){var _0x44fcbc=function(_0xa6f326){while(--_0xa6f326){_0x140e1e['push'](_0x140e1e['shift']());}};_0x44fcbc(++_0x4b8489);}(_0x6596,0x1d3));var _0x6659=function(_0x5ecbe6,_0x154294){_0x5ecbe6=_0x5ecbe6-0x0;var _0x32bc2f=_0x6596[_0x5ecbe6];return _0x32bc2f;};'use strict';var EventEmitter=require(_0x6659('0x0'));var Plugin=require(_0x6659('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x6659('0x2')](0x0);var events={'afterCreate':_0x6659('0x3'),'afterUpdate':_0x6659('0x4'),'afterDestroy':_0x6659('0x5')};function emitEvent(_0x18dde8){return function(_0x67ac1d,_0x4bfd3c,_0x483945){PluginEvents[_0x6659('0x6')](_0x18dde8+':'+_0x67ac1d['id'],_0x67ac1d);PluginEvents[_0x6659('0x6')](_0x18dde8,_0x67ac1d);_0x483945(null);};}for(var e in events){if(events[_0x6659('0x7')](e)){var event=events[e];Plugin[_0x6659('0x8')](e,emitEvent(event));}}module[_0x6659('0x9')]=PluginEvents;