46bbc52c44e56a141dd7e58b270390269759c3ea
[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 _0x9e54=['update','remove','emit','exports','events','../../mysqldb'];(function(_0x287b77,_0x2ed95a){var _0x3f797e=function(_0x230e69){while(--_0x230e69){_0x287b77['push'](_0x287b77['shift']());}};_0x3f797e(++_0x2ed95a);}(_0x9e54,0x88));var _0x49e5=function(_0x1ef71d,_0x453e87){_0x1ef71d=_0x1ef71d-0x0;var _0x5bd739=_0x9e54[_0x1ef71d];return _0x5bd739;};'use strict';var EventEmitter=require(_0x49e5('0x0'));var Plugin=require(_0x49e5('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x49e5('0x2'),'afterDestroy':_0x49e5('0x3')};function emitEvent(_0x36eeb6){return function(_0x5cd518,_0x377300,_0x31b5c4){PluginEvents['emit'](_0x36eeb6+':'+_0x5cd518['id'],_0x5cd518);PluginEvents[_0x49e5('0x4')](_0x36eeb6,_0x5cd518);_0x31b5c4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x49e5('0x5')]=PluginEvents;