98b8986ba5df45ecfad377285a175cdb2fc3e6db
[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 _0x0295=['remove','emit','hasOwnProperty','hook','events','setMaxListeners'];(function(_0x197df5,_0x3789c1){var _0x2ee0b2=function(_0x39c1b9){while(--_0x39c1b9){_0x197df5['push'](_0x197df5['shift']());}};_0x2ee0b2(++_0x3789c1);}(_0x0295,0x1f0));var _0x5029=function(_0x36782c,_0x38c321){_0x36782c=_0x36782c-0x0;var _0xd4e417=_0x0295[_0x36782c];return _0xd4e417;};'use strict';var EventEmitter=require(_0x5029('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x5029('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5029('0x2')};function emitEvent(_0x36335d){return function(_0x157a4f,_0x3d0af1,_0x170504){PluginEvents[_0x5029('0x3')](_0x36335d+':'+_0x157a4f['id'],_0x157a4f);PluginEvents[_0x5029('0x3')](_0x36335d,_0x157a4f);_0x170504(null);};}for(var e in events){if(events[_0x5029('0x4')](e)){var event=events[e];Plugin[_0x5029('0x5')](e,emitEvent(event));}}module['exports']=PluginEvents;