5a556970446e776dc38538a8dce1858ed02ccba1
[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 _0x80c3=['events','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x4b609d,_0x5176f0){var _0x4c36d4=function(_0x25f10d){while(--_0x25f10d){_0x4b609d['push'](_0x4b609d['shift']());}};_0x4c36d4(++_0x5176f0);}(_0x80c3,0x18f));var _0x380c=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x80c3[_0x491a7f];return _0x3d8f44;};'use strict';var EventEmitter=require(_0x380c('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x380c('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x380c('0x2'),'afterDestroy':_0x380c('0x3')};function emitEvent(_0x24728a){return function(_0x52fd7e,_0x565a08,_0x553158){PluginEvents[_0x380c('0x4')](_0x24728a+':'+_0x52fd7e['id'],_0x52fd7e);PluginEvents['emit'](_0x24728a,_0x52fd7e);_0x553158(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x380c('0x5')](e,emitEvent(event));}}module[_0x380c('0x6')]=PluginEvents;