6f35915912c8bd1b493525c1b6a676af8b3e74e8
[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 _0xaebd=['emit','hook','exports','events','Plugin','setMaxListeners','save','update','remove'];(function(_0x3593d5,_0x5bff1c){var _0x4b8b93=function(_0x160b68){while(--_0x160b68){_0x3593d5['push'](_0x3593d5['shift']());}};_0x4b8b93(++_0x5bff1c);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x463304,_0x2a29ae){_0x463304=_0x463304-0x0;var _0x3ee5f6=_0xaebd[_0x463304];return _0x3ee5f6;};'use strict';var EventEmitter=require(_0xdaeb('0x0'));var Plugin=require('../../mysqldb')['db'][_0xdaeb('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xdaeb('0x2')](0x0);var events={'afterCreate':_0xdaeb('0x3'),'afterUpdate':_0xdaeb('0x4'),'afterDestroy':_0xdaeb('0x5')};function emitEvent(_0x4acd42){return function(_0x44e982,_0x1c617a,_0x1a99be){PluginEvents[_0xdaeb('0x6')](_0x4acd42+':'+_0x44e982['id'],_0x44e982);PluginEvents[_0xdaeb('0x6')](_0x4acd42,_0x44e982);_0x1a99be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xdaeb('0x7')](e,emitEvent(event));}}module[_0xdaeb('0x8')]=PluginEvents;