43e0006ab4ec1e75fbbf111ca7926880f822c078
[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 _0x02ce=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','Plugin','save'];(function(_0x1033b9,_0x1154ce){var _0x5d10bb=function(_0x4bc28b){while(--_0x4bc28b){_0x1033b9['push'](_0x1033b9['shift']());}};_0x5d10bb(++_0x1154ce);}(_0x02ce,0x1ac));var _0xe02c=function(_0x42dbbd,_0x17b4a3){_0x42dbbd=_0x42dbbd-0x0;var _0x4ebafa=_0x02ce[_0x42dbbd];return _0x4ebafa;};'use strict';var EventEmitter=require(_0xe02c('0x0'));var Plugin=require(_0xe02c('0x1'))['db'][_0xe02c('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe02c('0x3'),'afterUpdate':'update','afterDestroy':_0xe02c('0x4')};function emitEvent(_0x3fb463){return function(_0x46475c,_0xf4b764,_0x41b41c){PluginEvents[_0xe02c('0x5')](_0x3fb463+':'+_0x46475c['id'],_0x46475c);PluginEvents[_0xe02c('0x5')](_0x3fb463,_0x46475c);_0x41b41c(null);};}for(var e in events){if(events[_0xe02c('0x6')](e)){var event=events[e];Plugin[_0xe02c('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents;