f40083724e571a08ed12a414741796fbef2e2590
[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 _0x55c1=['hasOwnProperty','exports','events','../../mysqldb','update','remove','emit'];(function(_0x32be4e,_0x3a2812){var _0x46721d=function(_0x174448){while(--_0x174448){_0x32be4e['push'](_0x32be4e['shift']());}};_0x46721d(++_0x3a2812);}(_0x55c1,0x1e5));var _0x155c=function(_0xcf581b,_0x4359dd){_0xcf581b=_0xcf581b-0x0;var _0x4f454d=_0x55c1[_0xcf581b];return _0x4f454d;};'use strict';var EventEmitter=require(_0x155c('0x0'));var Plugin=require(_0x155c('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x155c('0x2'),'afterDestroy':_0x155c('0x3')};function emitEvent(_0x30444a){return function(_0x64c8aa,_0xb127e8,_0x5305d5){PluginEvents[_0x155c('0x4')](_0x30444a+':'+_0x64c8aa['id'],_0x64c8aa);PluginEvents[_0x155c('0x4')](_0x30444a,_0x64c8aa);_0x5305d5(null);};}for(var e in events){if(events[_0x155c('0x5')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x155c('0x6')]=PluginEvents;