Built motion from commit (unavailable).|2.5.4
[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 _0xf61e=['hook','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4de5b6,_0x5cd845){var _0xc24eb1=function(_0x5bfa42){while(--_0x5bfa42){_0x4de5b6['push'](_0x4de5b6['shift']());}};_0xc24eb1(++_0x5cd845);}(_0xf61e,0x191));var _0xef61=function(_0x499f72,_0x6b4fd1){_0x499f72=_0x499f72-0x0;var _0x357ced=_0xf61e[_0x499f72];return _0x357ced;};'use strict';var EventEmitter=require(_0xef61('0x0'));var Plugin=require(_0xef61('0x1'))['db'][_0xef61('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xef61('0x3')](0x0);var events={'afterCreate':_0xef61('0x4'),'afterUpdate':_0xef61('0x5'),'afterDestroy':_0xef61('0x6')};function emitEvent(_0x40509e){return function(_0x2bd1d0,_0x14122a,_0x239fa9){PluginEvents[_0xef61('0x7')](_0x40509e+':'+_0x2bd1d0['id'],_0x2bd1d0);PluginEvents['emit'](_0x40509e,_0x2bd1d0);_0x239fa9(null);};}for(var e in events){if(events[_0xef61('0x8')](e)){var event=events[e];Plugin[_0xef61('0x9')](e,emitEvent(event));}}module['exports']=PluginEvents;