19aeb9909c96d5b2a7267dc52756f25be63b1639
[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 _0xfcbb=['../../mysqldb','Plugin','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x21a1aa,_0x8e9515){var _0x269115=function(_0x4f1caa){while(--_0x4f1caa){_0x21a1aa['push'](_0x21a1aa['shift']());}};_0x269115(++_0x8e9515);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x33afe9,_0x545867){_0x33afe9=_0x33afe9-0x0;var _0x42c7c5=_0xfcbb[_0x33afe9];return _0x42c7c5;};'use strict';var EventEmitter=require(_0xbfcb('0x0'));var Plugin=require(_0xbfcb('0x1'))['db'][_0xbfcb('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbfcb('0x3'),'afterDestroy':_0xbfcb('0x4')};function emitEvent(_0x341fcd){return function(_0x135741,_0x1d8b50,_0x5c5a1a){PluginEvents['emit'](_0x341fcd+':'+_0x135741['id'],_0x135741);PluginEvents[_0xbfcb('0x5')](_0x341fcd,_0x135741);_0x5c5a1a(null);};}for(var e in events){if(events[_0xbfcb('0x6')](e)){var event=events[e];Plugin[_0xbfcb('0x7')](e,emitEvent(event));}}module[_0xbfcb('0x8')]=PluginEvents;