a37927793a825edd7d3445144bc38c41da2a705f
[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 _0x095b=['events','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x196168,_0x2b6c2c){var _0x1fb65a=function(_0x1718f3){while(--_0x1718f3){_0x196168['push'](_0x196168['shift']());}};_0x1fb65a(++_0x2b6c2c);}(_0x095b,0x6e));var _0xb095=function(_0x5f0e11,_0xca06a2){_0x5f0e11=_0x5f0e11-0x0;var _0x40f16a=_0x095b[_0x5f0e11];return _0x40f16a;};'use strict';var EventEmitter=require(_0xb095('0x0'));var Plugin=require('../../mysqldb')['db'][_0xb095('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xb095('0x2')](0x0);var events={'afterCreate':_0xb095('0x3'),'afterUpdate':_0xb095('0x4'),'afterDestroy':_0xb095('0x5')};function emitEvent(_0x48b909){return function(_0x1a42a5,_0x25f040,_0x12979f){PluginEvents[_0xb095('0x6')](_0x48b909+':'+_0x1a42a5['id'],_0x1a42a5);PluginEvents[_0xb095('0x6')](_0x48b909,_0x1a42a5);_0x12979f(null);};}for(var e in events){if(events[_0xb095('0x7')](e)){var event=events[e];Plugin[_0xb095('0x8')](e,emitEvent(event));}}module[_0xb095('0x9')]=PluginEvents;