7ef95cbf0decd60b46398892c5e765e541f9f2a5
[motion2.git] / server / api / dashboard / dashboard.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 _0xd572=['save','update','remove','emit','hasOwnProperty','exports','Dashboard','setMaxListeners'];(function(_0x3a64b2,_0x4693e3){var _0x10413d=function(_0x20fb16){while(--_0x20fb16){_0x3a64b2['push'](_0x3a64b2['shift']());}};_0x10413d(++_0x4693e3);}(_0xd572,0xae));var _0x2d57=function(_0x56c0d0,_0x1346ee){_0x56c0d0=_0x56c0d0-0x0;var _0x3cda42=_0xd572[_0x56c0d0];return _0x3cda42;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0x2d57('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x2d57('0x1')](0x0);var events={'afterCreate':_0x2d57('0x2'),'afterUpdate':_0x2d57('0x3'),'afterDestroy':_0x2d57('0x4')};function emitEvent(_0x1a6c25){return function(_0x54b637,_0x4f6916,_0x2f9cec){DashboardEvents[_0x2d57('0x5')](_0x1a6c25+':'+_0x54b637['id'],_0x54b637);DashboardEvents[_0x2d57('0x5')](_0x1a6c25,_0x54b637);_0x2f9cec(null);};}for(var e in events){if(events[_0x2d57('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x2d57('0x7')]=DashboardEvents;