Built motion from commit 47436d59.|2.6.7
[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 _0x18b2=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Plugin'];(function(_0x592265,_0xfe52a){var _0x2dc3a7=function(_0x3c10e7){while(--_0x3c10e7){_0x592265['push'](_0x592265['shift']());}};_0x2dc3a7(++_0xfe52a);}(_0x18b2,0x85));var _0x218b=function(_0x28a378,_0x312a24){_0x28a378=_0x28a378-0x0;var _0x8e9e7d=_0x18b2[_0x28a378];return _0x8e9e7d;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x218b('0x0'))['db'][_0x218b('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x218b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x218b('0x3'),'afterDestroy':_0x218b('0x4')};function emitEvent(_0x3f15c3){return function(_0x3ffe21,_0xb6f819,_0x452eb6){PluginEvents[_0x218b('0x5')](_0x3f15c3+':'+_0x3ffe21['id'],_0x3ffe21);PluginEvents[_0x218b('0x5')](_0x3f15c3,_0x3ffe21);_0x452eb6(null);};}for(var e in events){if(events[_0x218b('0x6')](e)){var event=events[e];Plugin[_0x218b('0x7')](e,emitEvent(event));}}module[_0x218b('0x8')]=PluginEvents;