f1c84d3c14701b2f3152a8117c985e4aabd91534
[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 _0x8a5c=['emit','hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners','save','update'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8a5c,0x112));var _0xc8a5=function(_0x4c559f,_0x48fb90){_0x4c559f=_0x4c559f-0x0;var _0x21c1e9=_0x8a5c[_0x4c559f];return _0x21c1e9;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xc8a5('0x0'))['db'][_0xc8a5('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xc8a5('0x2')](0x0);var events={'afterCreate':_0xc8a5('0x3'),'afterUpdate':_0xc8a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0xe06918){return function(_0x2f628e,_0x5e4dda,_0x2931ea){PluginEvents['emit'](_0xe06918+':'+_0x2f628e['id'],_0x2f628e);PluginEvents[_0xc8a5('0x5')](_0xe06918,_0x2f628e);_0x2931ea(null);};}for(var e in events){if(events[_0xc8a5('0x6')](e)){var event=events[e];Plugin[_0xc8a5('0x7')](e,emitEvent(event));}}module[_0xc8a5('0x8')]=PluginEvents;