Built motion from commit f3da74b7.|2.5.36
[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 _0x8ac9=['remove','emit','exports','events','../../mysqldb','Plugin','update'];(function(_0x1366c2,_0x219667){var _0x53ce5c=function(_0x3fbf74){while(--_0x3fbf74){_0x1366c2['push'](_0x1366c2['shift']());}};_0x53ce5c(++_0x219667);}(_0x8ac9,0x199));var _0x98ac=function(_0x30f2d2,_0x413650){_0x30f2d2=_0x30f2d2-0x0;var _0x285f5c=_0x8ac9[_0x30f2d2];return _0x285f5c;};'use strict';var EventEmitter=require(_0x98ac('0x0'));var Plugin=require(_0x98ac('0x1'))['db'][_0x98ac('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x98ac('0x3'),'afterDestroy':_0x98ac('0x4')};function emitEvent(_0xd555bb){return function(_0x59f76b,_0x4bac60,_0x18968a){PluginEvents[_0x98ac('0x5')](_0xd555bb+':'+_0x59f76b['id'],_0x59f76b);PluginEvents[_0x98ac('0x5')](_0xd555bb,_0x59f76b);_0x18968a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x98ac('0x6')]=PluginEvents;