Built motion from commit (unavailable).|2.5.10
[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 _0x4bd3=['events','Plugin','setMaxListeners','emit','hook','exports'];(function(_0x1e7fb0,_0x91e1ff){var _0x1da125=function(_0x320bb1){while(--_0x320bb1){_0x1e7fb0['push'](_0x1e7fb0['shift']());}};_0x1da125(++_0x91e1ff);}(_0x4bd3,0x174));var _0x34bd=function(_0x3e680c,_0x5efc8d){_0x3e680c=_0x3e680c-0x0;var _0xc4c0ef=_0x4bd3[_0x3e680c];return _0xc4c0ef;};'use strict';var EventEmitter=require(_0x34bd('0x0'));var Plugin=require('../../mysqldb')['db'][_0x34bd('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x34bd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22b921){return function(_0x44854a,_0x1fc8eb,_0x5846f3){PluginEvents[_0x34bd('0x3')](_0x22b921+':'+_0x44854a['id'],_0x44854a);PluginEvents[_0x34bd('0x3')](_0x22b921,_0x44854a);_0x5846f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x34bd('0x4')](e,emitEvent(event));}}module[_0x34bd('0x5')]=PluginEvents;