ddcf14d273c9b76c173959134d4f3f57bc19548a
[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 _0x975b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','Plugin'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x975b,0x1c9));var _0xb975=function(_0x345673,_0xcbfb72){_0x345673=_0x345673-0x0;var _0x288132=_0x975b[_0x345673];return _0x288132;};'use strict';var EventEmitter=require(_0xb975('0x0'));var Plugin=require(_0xb975('0x1'))['db'][_0xb975('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xb975('0x3')](0x0);var events={'afterCreate':_0xb975('0x4'),'afterUpdate':_0xb975('0x5'),'afterDestroy':_0xb975('0x6')};function emitEvent(_0x5e662b){return function(_0xa92c72,_0xfb173,_0x2007e4){PluginEvents[_0xb975('0x7')](_0x5e662b+':'+_0xa92c72['id'],_0xa92c72);PluginEvents[_0xb975('0x7')](_0x5e662b,_0xa92c72);_0x2007e4(null);};}for(var e in events){if(events[_0xb975('0x8')](e)){var event=events[e];Plugin[_0xb975('0x9')](e,emitEvent(event));}}module['exports']=PluginEvents;