70222d29b1b1761d7885c40bcd69ab0005a4b844
[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 _0xc319=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','save'];(function(_0x2ec869,_0x59782e){var _0xdcbc41=function(_0x48c01f){while(--_0x48c01f){_0x2ec869['push'](_0x2ec869['shift']());}};_0xdcbc41(++_0x59782e);}(_0xc319,0x12e));var _0x9c31=function(_0x21076c,_0x35a7d2){_0x21076c=_0x21076c-0x0;var _0x20ae3c=_0xc319[_0x21076c];return _0x20ae3c;};'use strict';var EventEmitter=require(_0x9c31('0x0'));var Plugin=require(_0x9c31('0x1'))['db'][_0x9c31('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9c31('0x3'),'afterUpdate':_0x9c31('0x4'),'afterDestroy':'remove'};function emitEvent(_0x953a08){return function(_0x43faca,_0x16ed0c,_0x17d7dc){PluginEvents['emit'](_0x953a08+':'+_0x43faca['id'],_0x43faca);PluginEvents[_0x9c31('0x5')](_0x953a08,_0x43faca);_0x17d7dc(null);};}for(var e in events){if(events[_0x9c31('0x6')](e)){var event=events[e];Plugin[_0x9c31('0x7')](e,emitEvent(event));}}module[_0x9c31('0x8')]=PluginEvents;