811f452a3f04d9bd7e0a5425b35fc15cf993e838
[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 _0x75a2=['../../mysqldb','Plugin','save','update','remove','hook','exports','events'];(function(_0xf5f819,_0xb8b34c){var _0x398d9d=function(_0x1d9b55){while(--_0x1d9b55){_0xf5f819['push'](_0xf5f819['shift']());}};_0x398d9d(++_0xb8b34c);}(_0x75a2,0x187));var _0x275a=function(_0x27b4af,_0x5c1fcc){_0x27b4af=_0x27b4af-0x0;var _0xf6feef=_0x75a2[_0x27b4af];return _0xf6feef;};'use strict';var EventEmitter=require(_0x275a('0x0'));var Plugin=require(_0x275a('0x1'))['db'][_0x275a('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x275a('0x3'),'afterUpdate':_0x275a('0x4'),'afterDestroy':_0x275a('0x5')};function emitEvent(_0x6c21e9){return function(_0x5019d2,_0x251db9,_0x4f1945){PluginEvents['emit'](_0x6c21e9+':'+_0x5019d2['id'],_0x5019d2);PluginEvents['emit'](_0x6c21e9,_0x5019d2);_0x4f1945(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x275a('0x6')](e,emitEvent(event));}}module[_0x275a('0x7')]=PluginEvents;