9f7244c1f0f38dc3d5bf60f60edcb1dff805c4a7
[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 _0x7412=['setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x4fdbda,_0x23641a){var _0xddf5b6=function(_0xd4a955){while(--_0xd4a955){_0x4fdbda['push'](_0x4fdbda['shift']());}};_0xddf5b6(++_0x23641a);}(_0x7412,0x161));var _0x2741=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7412[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require(_0x2741('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x2741('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2741('0x2'),'afterDestroy':'remove'};function emitEvent(_0x51d3c5){return function(_0x509ce6,_0x552836,_0x521b65){PluginEvents['emit'](_0x51d3c5+':'+_0x509ce6['id'],_0x509ce6);PluginEvents[_0x2741('0x3')](_0x51d3c5,_0x509ce6);_0x521b65(null);};}for(var e in events){if(events[_0x2741('0x4')](e)){var event=events[e];Plugin[_0x2741('0x5')](e,emitEvent(event));}}module['exports']=PluginEvents;