6f9904493961567f9855e8d77bd097e20b11f3ec
[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 _0xf603=['update','remove','emit','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x25e704,_0x264e13){var _0x16697f=function(_0x100f7f){while(--_0x100f7f){_0x25e704['push'](_0x25e704['shift']());}};_0x16697f(++_0x264e13);}(_0xf603,0x124));var _0x3f60=function(_0x3e1daf,_0x440366){_0x3e1daf=_0x3e1daf-0x0;var _0x4de9c2=_0xf603[_0x3e1daf];return _0x4de9c2;};'use strict';var EventEmitter=require(_0x3f60('0x0'));var Plugin=require(_0x3f60('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x3f60('0x2')](0x0);var events={'afterCreate':_0x3f60('0x3'),'afterUpdate':_0x3f60('0x4'),'afterDestroy':_0x3f60('0x5')};function emitEvent(_0x360e59){return function(_0x1403db,_0x21a566,_0x15a654){PluginEvents[_0x3f60('0x6')](_0x360e59+':'+_0x1403db['id'],_0x1403db);PluginEvents['emit'](_0x360e59,_0x1403db);_0x15a654(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x3f60('0x7')]=PluginEvents;