Built motion from commit 9d1906d1.|2.5.40
[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 _0x7f54=['remove','emit','hasOwnProperty','hook','exports','events','WhatsappQueue','setMaxListeners','save'];(function(_0x53f04f,_0x419aa8){var _0x16a824=function(_0x5712c9){while(--_0x5712c9){_0x53f04f['push'](_0x53f04f['shift']());}};_0x16a824(++_0x419aa8);}(_0x7f54,0x1d0));var _0x47f5=function(_0x2e806c,_0x5e12c3){_0x2e806c=_0x2e806c-0x0;var _0x2da5bd=_0x7f54[_0x2e806c];return _0x2da5bd;};'use strict';var EventEmitter=require(_0x47f5('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x47f5('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x47f5('0x2')](0x0);var events={'afterCreate':_0x47f5('0x3'),'afterUpdate':'update','afterDestroy':_0x47f5('0x4')};function emitEvent(_0x46e5a9){return function(_0x542bb7,_0x4ccebd,_0x365700){WhatsappQueueEvents['emit'](_0x46e5a9+':'+_0x542bb7['id'],_0x542bb7);WhatsappQueueEvents[_0x47f5('0x5')](_0x46e5a9,_0x542bb7);_0x365700(null);};}for(var e in events){if(events[_0x47f5('0x6')](e)){var event=events[e];WhatsappQueue[_0x47f5('0x7')](e,emitEvent(event));}}module[_0x47f5('0x8')]=WhatsappQueueEvents;