Built motion from commit ffdca78c.|2.6.24
[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 _0x27eb=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2ed1ab,_0x30cfd7){var _0x782deb=function(_0x43d29e){while(--_0x43d29e){_0x2ed1ab['push'](_0x2ed1ab['shift']());}};_0x782deb(++_0x30cfd7);}(_0x27eb,0xd0));var _0xb27e=function(_0x2a1dd8,_0x4b1397){_0x2a1dd8=_0x2a1dd8-0x0;var _0x408a98=_0x27eb[_0x2a1dd8];return _0x408a98;};'use strict';var EventEmitter=require(_0xb27e('0x0'));var Plugin=require(_0xb27e('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb27e('0x2'),'afterUpdate':_0xb27e('0x3'),'afterDestroy':_0xb27e('0x4')};function emitEvent(_0x5c9b37){return function(_0x2ed7d7,_0x1d82eb,_0x2aab8e){PluginEvents[_0xb27e('0x5')](_0x5c9b37+':'+_0x2ed7d7['id'],_0x2ed7d7);PluginEvents['emit'](_0x5c9b37,_0x2ed7d7);_0x2aab8e(null);};}for(var e in events){if(events[_0xb27e('0x6')](e)){var event=events[e];Plugin[_0xb27e('0x7')](e,emitEvent(event));}}module[_0xb27e('0x8')]=PluginEvents;