Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / plugin / plugin.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 _0xa751=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','update'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xa751,0x175));var _0x1a75=function(_0x2edbca,_0xd54fda){_0x2edbca=_0x2edbca-0x0;var _0x5e1392=_0xa751[_0x2edbca];return _0x5e1392;};'use strict';var EventEmitter=require(_0x1a75('0x0'));var Plugin=require(_0x1a75('0x1'))['db'][_0x1a75('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x1a75('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a75('0x4'),'afterDestroy':'remove'};function emitEvent(_0x31db55){return function(_0x95fa7,_0x2ea393,_0x4ebf37){PluginEvents[_0x1a75('0x5')](_0x31db55+':'+_0x95fa7['id'],_0x95fa7);PluginEvents[_0x1a75('0x5')](_0x31db55,_0x95fa7);_0x4ebf37(null);};}for(var e in events){if(events[_0x1a75('0x6')](e)){var event=events[e];Plugin[_0x1a75('0x7')](e,emitEvent(event));}}module[_0x1a75('0x8')]=PluginEvents;