Built motion from commit 9d1906d1.|2.5.40
[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 _0x3595=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x25e0fc,_0x4c05ed){var _0x37edaf=function(_0x53213a){while(--_0x53213a){_0x25e0fc['push'](_0x25e0fc['shift']());}};_0x37edaf(++_0x4c05ed);}(_0x3595,0x147));var _0x5359=function(_0x17731b,_0x45ef0f){_0x17731b=_0x17731b-0x0;var _0x5de4b1=_0x3595[_0x17731b];return _0x5de4b1;};'use strict';var EventEmitter=require(_0x5359('0x0'));var Plugin=require(_0x5359('0x1'))['db'][_0x5359('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5359('0x3'),'afterUpdate':_0x5359('0x4'),'afterDestroy':_0x5359('0x5')};function emitEvent(_0x3fd018){return function(_0x1fa814,_0x125c76,_0x4e42e0){PluginEvents['emit'](_0x3fd018+':'+_0x1fa814['id'],_0x1fa814);PluginEvents[_0x5359('0x6')](_0x3fd018,_0x1fa814);_0x4e42e0(null);};}for(var e in events){if(events[_0x5359('0x7')](e)){var event=events[e];Plugin[_0x5359('0x8')](e,emitEvent(event));}}module[_0x5359('0x9')]=PluginEvents;