Built motion from commit 351e7f9c.|2.6.31
[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 _0x0f4d=['setMaxListeners','update','remove','emit','hook','exports'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x318c6f,_0x59c9f3){_0x318c6f=_0x318c6f-0x0;var _0x347806=_0x0f4d[_0x318c6f];return _0x347806;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xd0f4('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd0f4('0x1'),'afterDestroy':_0xd0f4('0x2')};function emitEvent(_0x3ac2a3){return function(_0x347170,_0x1a9ba5,_0x2a0efc){PluginEvents[_0xd0f4('0x3')](_0x3ac2a3+':'+_0x347170['id'],_0x347170);PluginEvents[_0xd0f4('0x3')](_0x3ac2a3,_0x347170);_0x2a0efc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xd0f4('0x4')](e,emitEvent(event));}}module[_0xd0f4('0x5')]=PluginEvents;