5163f729ad1367cd59b1cff2b3e33a752f1c2bc0
[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 _0xecb2=['exports','events','setMaxListeners','remove','emit'];(function(_0x2f53eb,_0x21b3a2){var _0xf5205b=function(_0x4d8d96){while(--_0x4d8d96){_0x2f53eb['push'](_0x2f53eb['shift']());}};_0xf5205b(++_0x21b3a2);}(_0xecb2,0xf6));var _0x2ecb=function(_0x59f8b7,_0x10e61e){_0x59f8b7=_0x59f8b7-0x0;var _0x52930c=_0xecb2[_0x59f8b7];return _0x52930c;};'use strict';var EventEmitter=require(_0x2ecb('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x2ecb('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2ecb('0x2')};function emitEvent(_0x2f3639){return function(_0x393e7c,_0x2a4fe5,_0x1d007c){PluginEvents[_0x2ecb('0x3')](_0x2f3639+':'+_0x393e7c['id'],_0x393e7c);PluginEvents['emit'](_0x2f3639,_0x393e7c);_0x1d007c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x2ecb('0x4')]=PluginEvents;