78eb88ead9f9f44c4e4cf33701edbefe8e1a2002
[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 _0x430c=['update','emit','hasOwnProperty','exports','events','setMaxListeners','save'];(function(_0x94b9d4,_0x1d58d8){var _0x4dfe17=function(_0x3f9aa4){while(--_0x3f9aa4){_0x94b9d4['push'](_0x94b9d4['shift']());}};_0x4dfe17(++_0x1d58d8);}(_0x430c,0x1a1));var _0xc430=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x430c[_0x5627e1];return _0x2f013f;};'use strict';var EventEmitter=require(_0xc430('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xc430('0x1')](0x0);var events={'afterCreate':_0xc430('0x2'),'afterUpdate':_0xc430('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4f0118){return function(_0x5ccda6,_0x47d8b9,_0x338a82){PluginEvents[_0xc430('0x4')](_0x4f0118+':'+_0x5ccda6['id'],_0x5ccda6);PluginEvents['emit'](_0x4f0118,_0x5ccda6);_0x338a82(null);};}for(var e in events){if(events[_0xc430('0x5')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xc430('0x6')]=PluginEvents;