Built motion from commit dc14b02d.|2.6.27
[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 _0x5398=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0x5398,0xe2));var _0x8539=function(_0x1b455f,_0x4cfd39){_0x1b455f=_0x1b455f-0x0;var _0xe59ed5=_0x5398[_0x1b455f];return _0xe59ed5;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x8539('0x0'))['db'][_0x8539('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x8539('0x2')](0x0);var events={'afterCreate':_0x8539('0x3'),'afterUpdate':_0x8539('0x4'),'afterDestroy':_0x8539('0x5')};function emitEvent(_0x27751){return function(_0x4e7787,_0x5ed870,_0x82ad80){PluginEvents[_0x8539('0x6')](_0x27751+':'+_0x4e7787['id'],_0x4e7787);PluginEvents[_0x8539('0x6')](_0x27751,_0x4e7787);_0x82ad80(null);};}for(var e in events){if(events[_0x8539('0x7')](e)){var event=events[e];Plugin[_0x8539('0x8')](e,emitEvent(event));}}module[_0x8539('0x9')]=PluginEvents;