Built motion from commit e02f907f.|2.6.14
[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 _0xd45e=['exports','../../mysqldb','Plugin','save','remove','emit','hook'];(function(_0xe6a5c1,_0x4c1063){var _0x63fcf3=function(_0x4b96be){while(--_0x4b96be){_0xe6a5c1['push'](_0xe6a5c1['shift']());}};_0x63fcf3(++_0x4c1063);}(_0xd45e,0x182));var _0xed45=function(_0x5e55a8,_0x2578e5){_0x5e55a8=_0x5e55a8-0x0;var _0x38e2b6=_0xd45e[_0x5e55a8];return _0x38e2b6;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xed45('0x0'))['db'][_0xed45('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xed45('0x2'),'afterUpdate':'update','afterDestroy':_0xed45('0x3')};function emitEvent(_0x4011bb){return function(_0x9c1494,_0x5667ca,_0x32fcff){PluginEvents[_0xed45('0x4')](_0x4011bb+':'+_0x9c1494['id'],_0x9c1494);PluginEvents['emit'](_0x4011bb,_0x9c1494);_0x32fcff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xed45('0x5')](e,emitEvent(event));}}module[_0xed45('0x6')]=PluginEvents;