Built motion from commit f25620e4.|2.6.30
[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 _0xfd2e=['events','Plugin','save','remove','hasOwnProperty'];(function(_0x54825e,_0x127d0e){var _0x3e07e9=function(_0x35930b){while(--_0x35930b){_0x54825e['push'](_0x54825e['shift']());}};_0x3e07e9(++_0x127d0e);}(_0xfd2e,0x6e));var _0xefd2=function(_0x27b9da,_0x224fbf){_0x27b9da=_0x27b9da-0x0;var _0x2be9b5=_0xfd2e[_0x27b9da];return _0x2be9b5;};'use strict';var EventEmitter=require(_0xefd2('0x0'));var Plugin=require('../../mysqldb')['db'][_0xefd2('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xefd2('0x2'),'afterUpdate':'update','afterDestroy':_0xefd2('0x3')};function emitEvent(_0x1c75dd){return function(_0x2b6511,_0x11d644,_0x2e095c){PluginEvents['emit'](_0x1c75dd+':'+_0x2b6511['id'],_0x2b6511);PluginEvents['emit'](_0x1c75dd,_0x2b6511);_0x2e095c(null);};}for(var e in events){if(events[_0xefd2('0x4')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents;