Built motion from commit b5413ace.|2.6.9
[motion2.git] / server / api / whatsappQueue / whatsappQueue.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 _0xb85a=['hook','exports','WhatsappQueue','save','update','remove','emit'];(function(_0xb2099e,_0x4cb864){var _0x586ed4=function(_0x2a10e9){while(--_0x2a10e9){_0xb2099e['push'](_0xb2099e['shift']());}};_0x586ed4(++_0x4cb864);}(_0xb85a,0xb8));var _0xab85=function(_0x413a0f,_0x229dfb){_0x413a0f=_0x413a0f-0x0;var _0x439f5d=_0xb85a[_0x413a0f];return _0x439f5d;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0xab85('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xab85('0x1'),'afterUpdate':_0xab85('0x2'),'afterDestroy':_0xab85('0x3')};function emitEvent(_0x54cc95){return function(_0x1ece00,_0x11f5fb,_0x1ded04){WhatsappQueueEvents[_0xab85('0x4')](_0x54cc95+':'+_0x1ece00['id'],_0x1ece00);WhatsappQueueEvents[_0xab85('0x4')](_0x54cc95,_0x1ece00);_0x1ded04(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xab85('0x5')](e,emitEvent(event));}}module[_0xab85('0x6')]=WhatsappQueueEvents;