Built motion from commit 85328c08.|2.5.50
[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 _0x0d4d=['events','../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x2e91d2,_0xe35e8a){var _0x25a889=function(_0x4e0d32){while(--_0x4e0d32){_0x2e91d2['push'](_0x2e91d2['shift']());}};_0x25a889(++_0xe35e8a);}(_0x0d4d,0x132));var _0xd0d4=function(_0x3dc84d,_0x2e77f7){_0x3dc84d=_0x3dc84d-0x0;var _0x467050=_0x0d4d[_0x3dc84d];return _0x467050;};'use strict';var EventEmitter=require(_0xd0d4('0x0'));var Plugin=require(_0xd0d4('0x1'))['db'][_0xd0d4('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xd0d4('0x3')](0x0);var events={'afterCreate':_0xd0d4('0x4'),'afterUpdate':_0xd0d4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x984664){return function(_0x58909f,_0x2e99ee,_0x3787f4){PluginEvents['emit'](_0x984664+':'+_0x58909f['id'],_0x58909f);PluginEvents[_0xd0d4('0x6')](_0x984664,_0x58909f);_0x3787f4(null);};}for(var e in events){if(events[_0xd0d4('0x7')](e)){var event=events[e];Plugin[_0xd0d4('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents;