Built motion from commit e6806ed6.|2.6.0
[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 _0x5162=['update','remove','emit','exports','events'];(function(_0x4d97b2,_0x55f7e0){var _0x432e28=function(_0x50253b){while(--_0x50253b){_0x4d97b2['push'](_0x4d97b2['shift']());}};_0x432e28(++_0x55f7e0);}(_0x5162,0x103));var _0x2516=function(_0x5d2699,_0xbb63f2){_0x5d2699=_0x5d2699-0x0;var _0x2a2ee6=_0x5162[_0x5d2699];return _0x2a2ee6;};'use strict';var EventEmitter=require(_0x2516('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2516('0x1'),'afterDestroy':_0x2516('0x2')};function emitEvent(_0x3ce7de){return function(_0x2d0b53,_0x2e48b6,_0x25dce6){PluginEvents[_0x2516('0x3')](_0x3ce7de+':'+_0x2d0b53['id'],_0x2d0b53);PluginEvents['emit'](_0x3ce7de,_0x2d0b53);_0x25dce6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x2516('0x4')]=PluginEvents;