93a84796a7b9a01af7db1320efda79228ded8fe2
[motion2.git] / server / api / dashboardItem / dashboardItem.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 _0xf459=['hook','exports','events','../../mysqldb','DashboardItem','update','remove','emit','hasOwnProperty'];(function(_0x1e7be1,_0x161891){var _0x5c9c54=function(_0x5e377b){while(--_0x5e377b){_0x1e7be1['push'](_0x1e7be1['shift']());}};_0x5c9c54(++_0x161891);}(_0xf459,0x16a));var _0x9f45=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xf459[_0x18cd5b];return _0x5eaa52;};'use strict';var EventEmitter=require(_0x9f45('0x0'));var DashboardItem=require(_0x9f45('0x1'))['db'][_0x9f45('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9f45('0x3'),'afterDestroy':_0x9f45('0x4')};function emitEvent(_0x31c18f){return function(_0x55ce58,_0x236101,_0x32827c){DashboardItemEvents['emit'](_0x31c18f+':'+_0x55ce58['id'],_0x55ce58);DashboardItemEvents[_0x9f45('0x5')](_0x31c18f,_0x55ce58);_0x32827c(null);};}for(var e in events){if(events[_0x9f45('0x6')](e)){var event=events[e];DashboardItem[_0x9f45('0x7')](e,emitEvent(event));}}module[_0x9f45('0x8')]=DashboardItemEvents;