db97a9912ead1b3bafac8569faaf91d6684b3f93
[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 _0xdbf5=['emit','hasOwnProperty','hook','exports','../../mysqldb','save','update','remove'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x371d4c,_0x2ea526){_0x371d4c=_0x371d4c-0x0;var _0x5a0c75=_0xdbf5[_0x371d4c];return _0x5a0c75;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x5dbf('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5dbf('0x1'),'afterUpdate':_0x5dbf('0x2'),'afterDestroy':_0x5dbf('0x3')};function emitEvent(_0x3afe14){return function(_0x38b629,_0x1a1ea9,_0x776036){PluginEvents[_0x5dbf('0x4')](_0x3afe14+':'+_0x38b629['id'],_0x38b629);PluginEvents[_0x5dbf('0x4')](_0x3afe14,_0x38b629);_0x776036(null);};}for(var e in events){if(events[_0x5dbf('0x5')](e)){var event=events[e];Plugin[_0x5dbf('0x6')](e,emitEvent(event));}}module[_0x5dbf('0x7')]=PluginEvents;