Built motion from commit (unavailable).|2.5.17
[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 _0x1c9a=['events','Plugin','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x24d268,_0x54cbcf){var _0x25f6f6=function(_0x2c6c38){while(--_0x2c6c38){_0x24d268['push'](_0x24d268['shift']());}};_0x25f6f6(++_0x54cbcf);}(_0x1c9a,0x98));var _0xa1c9=function(_0xb87ff7,_0x1471da){_0xb87ff7=_0xb87ff7-0x0;var _0x438bac=_0x1c9a[_0xb87ff7];return _0x438bac;};'use strict';var EventEmitter=require(_0xa1c9('0x0'));var Plugin=require('../../mysqldb')['db'][_0xa1c9('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa1c9('0x2'),'afterUpdate':_0xa1c9('0x3'),'afterDestroy':_0xa1c9('0x4')};function emitEvent(_0x4bf57e){return function(_0x21c0fc,_0x45d1f7,_0x20f0bf){PluginEvents[_0xa1c9('0x5')](_0x4bf57e+':'+_0x21c0fc['id'],_0x21c0fc);PluginEvents['emit'](_0x4bf57e,_0x21c0fc);_0x20f0bf(null);};}for(var e in events){if(events[_0xa1c9('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xa1c9('0x7')]=PluginEvents;