Built motion from commit (unavailable).|2.5.14
[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 _0x0598=['emit','exports','events','../../mysqldb','setMaxListeners','remove'];(function(_0x4f8afb,_0x96ee23){var _0x515ac9=function(_0x4d48f1){while(--_0x4d48f1){_0x4f8afb['push'](_0x4f8afb['shift']());}};_0x515ac9(++_0x96ee23);}(_0x0598,0x92));var _0x8059=function(_0x18eda7,_0x59ebe8){_0x18eda7=_0x18eda7-0x0;var _0xa4360e=_0x0598[_0x18eda7];return _0xa4360e;};'use strict';var EventEmitter=require(_0x8059('0x0'));var Plugin=require(_0x8059('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x8059('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8059('0x3')};function emitEvent(_0x236234){return function(_0x54b9a2,_0x54f42f,_0x555fb5){PluginEvents[_0x8059('0x4')](_0x236234+':'+_0x54b9a2['id'],_0x54b9a2);PluginEvents[_0x8059('0x4')](_0x236234,_0x54b9a2);_0x555fb5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x8059('0x5')]=PluginEvents;