Built motion from commit ce03bc3d.|2.5.39
[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 _0x1f2d=['hook','exports','events','../../mysqldb','Plugin','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x4bf2a7,_0xafae78){var _0x3450c0=function(_0x3ea142){while(--_0x3ea142){_0x4bf2a7['push'](_0x4bf2a7['shift']());}};_0x3450c0(++_0xafae78);}(_0x1f2d,0x1c4));var _0xd1f2=function(_0x39d6a8,_0xc9c91a){_0x39d6a8=_0x39d6a8-0x0;var _0x93f3db=_0x1f2d[_0x39d6a8];return _0x93f3db;};'use strict';var EventEmitter=require(_0xd1f2('0x0'));var Plugin=require(_0xd1f2('0x1'))['db'][_0xd1f2('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xd1f2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd1f2('0x4'),'afterDestroy':_0xd1f2('0x5')};function emitEvent(_0x13626e){return function(_0xd4f928,_0x21f154,_0x194b49){PluginEvents[_0xd1f2('0x6')](_0x13626e+':'+_0xd4f928['id'],_0xd4f928);PluginEvents[_0xd1f2('0x6')](_0x13626e,_0xd4f928);_0x194b49(null);};}for(var e in events){if(events[_0xd1f2('0x7')](e)){var event=events[e];Plugin[_0xd1f2('0x8')](e,emitEvent(event));}}module[_0xd1f2('0x9')]=PluginEvents;