c71f8d30a4c49576241240b66cab01f60801fff2
[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 _0xdb28=['Plugin','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x3beeea,_0x3f6d7a){var _0x47f053=function(_0x4e824e){while(--_0x4e824e){_0x3beeea['push'](_0x3beeea['shift']());}};_0x47f053(++_0x3f6d7a);}(_0xdb28,0x106));var _0x8db2=function(_0x376e4a,_0x47f626){_0x376e4a=_0x376e4a-0x0;var _0x3f90f0=_0xdb28[_0x376e4a];return _0x3f90f0;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var Plugin=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){PluginEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);PluginEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=PluginEvents;