a70cf714dd9a96d97d98bc3d2ab4ca52960f8561
[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 _0x4300=['hasOwnProperty','exports','events','update','remove','emit'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x4300,0x1a6));var _0x0430=function(_0x8ddb51,_0x1c283b){_0x8ddb51=_0x8ddb51-0x0;var _0x3873fe=_0x4300[_0x8ddb51];return _0x3873fe;};'use strict';var EventEmitter=require(_0x0430('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0430('0x1'),'afterDestroy':_0x0430('0x2')};function emitEvent(_0x1c139f){return function(_0x2a1e62,_0x1735aa,_0x5d0aac){PluginEvents[_0x0430('0x3')](_0x1c139f+':'+_0x2a1e62['id'],_0x2a1e62);PluginEvents['emit'](_0x1c139f,_0x2a1e62);_0x5d0aac(null);};}for(var e in events){if(events[_0x0430('0x4')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x0430('0x5')]=PluginEvents;