Built motion from commit 00bf23f6.|2.6.16
[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 _0xe558=['hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3b3e93,_0x314b02){var _0x12edf9=function(_0x1b2e95){while(--_0x1b2e95){_0x3b3e93['push'](_0x3b3e93['shift']());}};_0x12edf9(++_0x314b02);}(_0xe558,0x70));var _0x8e55=function(_0x3abdf0,_0xe5a075){_0x3abdf0=_0x3abdf0-0x0;var _0x20c869=_0xe558[_0x3abdf0];return _0x20c869;};'use strict';var EventEmitter=require(_0x8e55('0x0'));var Plugin=require(_0x8e55('0x1'))['db'][_0x8e55('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x8e55('0x3')](0x0);var events={'afterCreate':_0x8e55('0x4'),'afterUpdate':_0x8e55('0x5'),'afterDestroy':_0x8e55('0x6')};function emitEvent(_0x3a5285){return function(_0x28c870,_0x5bc807,_0xf125cc){PluginEvents[_0x8e55('0x7')](_0x3a5285+':'+_0x28c870['id'],_0x28c870);PluginEvents[_0x8e55('0x7')](_0x3a5285,_0x28c870);_0xf125cc(null);};}for(var e in events){if(events[_0x8e55('0x8')](e)){var event=events[e];Plugin[_0x8e55('0x9')](e,emitEvent(event));}}module[_0x8e55('0xa')]=PluginEvents;