Built motion from commit fe909640.|2.6.8
[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 _0xfb65=['remove','emit','hook','exports','../../mysqldb','Plugin','save'];(function(_0x7d2c6e,_0x47a087){var _0x38aca9=function(_0x5ec86c){while(--_0x5ec86c){_0x7d2c6e['push'](_0x7d2c6e['shift']());}};_0x38aca9(++_0x47a087);}(_0xfb65,0x82));var _0x5fb6=function(_0x48ebdc,_0x4fbccc){_0x48ebdc=_0x48ebdc-0x0;var _0x1fecca=_0xfb65[_0x48ebdc];return _0x1fecca;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x5fb6('0x0'))['db'][_0x5fb6('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5fb6('0x2'),'afterUpdate':'update','afterDestroy':_0x5fb6('0x3')};function emitEvent(_0x15d15c){return function(_0xca6345,_0xb5f7c4,_0x3a3b1b){PluginEvents[_0x5fb6('0x4')](_0x15d15c+':'+_0xca6345['id'],_0xca6345);PluginEvents['emit'](_0x15d15c,_0xca6345);_0x3a3b1b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x5fb6('0x5')](e,emitEvent(event));}}module[_0x5fb6('0x6')]=PluginEvents;