Built motion from commit 838c2833.|2.6.24
[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 _0xf3a7=['hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit'];(function(_0x2f4359,_0x4a78e3){var _0x193871=function(_0x18ff72){while(--_0x18ff72){_0x2f4359['push'](_0x2f4359['shift']());}};_0x193871(++_0x4a78e3);}(_0xf3a7,0x99));var _0x7f3a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf3a7[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x7f3a('0x0'))['db'][_0x7f3a('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x7f3a('0x2')](0x0);var events={'afterCreate':_0x7f3a('0x3'),'afterUpdate':_0x7f3a('0x4'),'afterDestroy':_0x7f3a('0x5')};function emitEvent(_0x3dae59){return function(_0x332a7a,_0x25cdee,_0x3285ad){PluginEvents['emit'](_0x3dae59+':'+_0x332a7a['id'],_0x332a7a);PluginEvents[_0x7f3a('0x6')](_0x3dae59,_0x332a7a);_0x3285ad(null);};}for(var e in events){if(events[_0x7f3a('0x7')](e)){var event=events[e];Plugin[_0x7f3a('0x8')](e,emitEvent(event));}}module[_0x7f3a('0x9')]=PluginEvents;