Built motion from commit 616d3211.|2.6.4
[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 _0x99fb=['hasOwnProperty','exports','events','Plugin','setMaxListeners','save','update','remove','emit'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x99fb,0x92));var _0xb99f=function(_0x1e65a5,_0x46212f){_0x1e65a5=_0x1e65a5-0x0;var _0x20620b=_0x99fb[_0x1e65a5];return _0x20620b;};'use strict';var EventEmitter=require(_0xb99f('0x0'));var Plugin=require('../../mysqldb')['db'][_0xb99f('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xb99f('0x2')](0x0);var events={'afterCreate':_0xb99f('0x3'),'afterUpdate':_0xb99f('0x4'),'afterDestroy':_0xb99f('0x5')};function emitEvent(_0x5891ab){return function(_0x23a1ef,_0x3e0d06,_0x58357b){PluginEvents[_0xb99f('0x6')](_0x5891ab+':'+_0x23a1ef['id'],_0x23a1ef);PluginEvents[_0xb99f('0x6')](_0x5891ab,_0x23a1ef);_0x58357b(null);};}for(var e in events){if(events[_0xb99f('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xb99f('0x8')]=PluginEvents;