f729a1129789ecd86732a7921b2300e3b2387d82
[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 _0x510e=['Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x510e,0x1ed));var _0xe510=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x510e[_0x68c979];return _0x4f0001;};'use strict';var EventEmitter=require(_0xe510('0x0'));var Plugin=require(_0xe510('0x1'))['db'][_0xe510('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xe510('0x3')](0x0);var events={'afterCreate':_0xe510('0x4'),'afterUpdate':_0xe510('0x5'),'afterDestroy':_0xe510('0x6')};function emitEvent(_0x2a9a5b){return function(_0x3cd0a5,_0x4dd477,_0x1953ba){PluginEvents[_0xe510('0x7')](_0x2a9a5b+':'+_0x3cd0a5['id'],_0x3cd0a5);PluginEvents[_0xe510('0x7')](_0x2a9a5b,_0x3cd0a5);_0x1953ba(null);};}for(var e in events){if(events[_0xe510('0x8')](e)){var event=events[e];Plugin[_0xe510('0x9')](e,emitEvent(event));}}module[_0xe510('0xa')]=PluginEvents;