c51db998e85da44a89cb1bf29af9fbb9c97f4ee0
[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 _0x0619=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','update','remove'];(function(_0x4113f8,_0x21f91c){var _0x1201d9=function(_0x1a5ebe){while(--_0x1a5ebe){_0x4113f8['push'](_0x4113f8['shift']());}};_0x1201d9(++_0x21f91c);}(_0x0619,0x90));var _0x9061=function(_0x3d46fb,_0x27709e){_0x3d46fb=_0x3d46fb-0x0;var _0x4ddbbf=_0x0619[_0x3d46fb];return _0x4ddbbf;};'use strict';var EventEmitter=require(_0x9061('0x0'));var Plugin=require(_0x9061('0x1'))['db'][_0x9061('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x9061('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9061('0x4'),'afterDestroy':_0x9061('0x5')};function emitEvent(_0x1f0fe8){return function(_0x1384a7,_0x1bc8ce,_0xa713e1){PluginEvents[_0x9061('0x6')](_0x1f0fe8+':'+_0x1384a7['id'],_0x1384a7);PluginEvents[_0x9061('0x6')](_0x1f0fe8,_0x1384a7);_0xa713e1(null);};}for(var e in events){if(events[_0x9061('0x7')](e)){var event=events[e];Plugin[_0x9061('0x8')](e,emitEvent(event));}}module[_0x9061('0x9')]=PluginEvents;