6757cb0fde77f8b1a514dca613431c55955f6497
[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 _0xd4a2=['setMaxListeners','update','emit','hasOwnProperty','exports','events'];(function(_0xac7cdd,_0x48bb50){var _0x2957d8=function(_0x17e34f){while(--_0x17e34f){_0xac7cdd['push'](_0xac7cdd['shift']());}};_0x2957d8(++_0x48bb50);}(_0xd4a2,0x173));var _0x2d4a=function(_0x101c86,_0x42749e){_0x101c86=_0x101c86-0x0;var _0x30233c=_0xd4a2[_0x101c86];return _0x30233c;};'use strict';var EventEmitter=require(_0x2d4a('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x2d4a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2d4a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x24810d){return function(_0x5d435a,_0x32af9e,_0x40d744){PluginEvents[_0x2d4a('0x3')](_0x24810d+':'+_0x5d435a['id'],_0x5d435a);PluginEvents[_0x2d4a('0x3')](_0x24810d,_0x5d435a);_0x40d744(null);};}for(var e in events){if(events[_0x2d4a('0x4')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x2d4a('0x5')]=PluginEvents;