47c743409b0fd2fc0379ec19228b2c2c4a740f16
[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 _0x0c75=['hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x349eb0,_0x542752){var _0x5588c8=function(_0x4d1da9){while(--_0x4d1da9){_0x349eb0['push'](_0x349eb0['shift']());}};_0x5588c8(++_0x542752);}(_0x0c75,0x6a));var _0x50c7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0c75[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x50c7('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x50c7('0x1')](0x0);var events={'afterCreate':_0x50c7('0x2'),'afterUpdate':_0x50c7('0x3'),'afterDestroy':_0x50c7('0x4')};function emitEvent(_0x41ebd8){return function(_0x344563,_0x3c0314,_0x5d8fad){PluginEvents[_0x50c7('0x5')](_0x41ebd8+':'+_0x344563['id'],_0x344563);PluginEvents['emit'](_0x41ebd8,_0x344563);_0x5d8fad(null);};}for(var e in events){if(events[_0x50c7('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x50c7('0x7')]=PluginEvents;