914741197f5184b95a96cf7ab4de518c4d55cf6f
[motion2.git] / server / api / chatQueue / chatQueue.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 _0xd689=['ChatQueue','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x353ee5,_0x22ba2d){var _0x7dd7a8=function(_0x1b5e03){while(--_0x1b5e03){_0x353ee5['push'](_0x353ee5['shift']());}};_0x7dd7a8(++_0x22ba2d);}(_0xd689,0x188));var _0x9d68=function(_0x15a9cb,_0x2c5d45){_0x15a9cb=_0x15a9cb-0x0;var _0x4036e4=_0xd689[_0x15a9cb];return _0x4036e4;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x9d68('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x9d68('0x1')](0x0);var events={'afterCreate':_0x9d68('0x2'),'afterUpdate':'update','afterDestroy':_0x9d68('0x3')};function emitEvent(_0x5d7fc2){return function(_0x11275e,_0x3bccce,_0x37adcd){ChatQueueEvents['emit'](_0x5d7fc2+':'+_0x11275e['id'],_0x11275e);ChatQueueEvents[_0x9d68('0x4')](_0x5d7fc2,_0x11275e);_0x37adcd(null);};}for(var e in events){if(events[_0x9d68('0x5')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x9d68('0x6')]=ChatQueueEvents;