7092832e2abb3eb98814e2ccb90d08157989bdc3
[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 _0x96e0=['update','remove','emit','hasOwnProperty','hook','exports','events','Plugin'];(function(_0x1d43cb,_0x4aac5d){var _0x39010d=function(_0x1bbdd3){while(--_0x1bbdd3){_0x1d43cb['push'](_0x1d43cb['shift']());}};_0x39010d(++_0x4aac5d);}(_0x96e0,0x7e));var _0x096e=function(_0x51747c,_0x1ee4ae){_0x51747c=_0x51747c-0x0;var _0x1bdc6f=_0x96e0[_0x51747c];return _0x1bdc6f;};'use strict';var EventEmitter=require(_0x096e('0x0'));var Plugin=require('../../mysqldb')['db'][_0x096e('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x096e('0x2'),'afterDestroy':_0x096e('0x3')};function emitEvent(_0x44027f){return function(_0xaf295b,_0x58d22d,_0x54a9b6){PluginEvents['emit'](_0x44027f+':'+_0xaf295b['id'],_0xaf295b);PluginEvents[_0x096e('0x4')](_0x44027f,_0xaf295b);_0x54a9b6(null);};}for(var e in events){if(events[_0x096e('0x5')](e)){var event=events[e];Plugin[_0x096e('0x6')](e,emitEvent(event));}}module[_0x096e('0x7')]=PluginEvents;