Built motion from commit 82a371561bcdbc7605c801e5e414f4032ba9e7ad. Version 3.0.0...
[motion-next.git] / server / api / plugin / plugin.events.js
1 const a516_0x2380=['remove','update','emit','../../mysqldb','exports','Plugin','addHook'];(function(_0x23190f,_0x238069){const _0x101442=function(_0x210f62){while(--_0x210f62){_0x23190f['push'](_0x23190f['shift']());}};_0x101442(++_0x238069);}(a516_0x2380,0x12a));const a516_0x1014=function(_0x23190f,_0x238069){_0x23190f=_0x23190f-0x0;let _0x101442=a516_0x2380[_0x23190f];return _0x101442;};const _0x208610=a516_0x1014;'use strict';const EventEmitter=require('events'),Plugin=require(_0x208610('0x6'))['db'][_0x208610('0x1')],PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);const events={'afterCreate':'save','afterUpdate':_0x208610('0x4'),'afterDestroy':_0x208610('0x3')};function emitEvent(_0x210f62){return function(_0x7b2357){const _0xcf047f=a516_0x1014;PluginEvents['emit'](_0x210f62+':'+_0x7b2357['id'],_0x7b2357),PluginEvents[_0xcf047f('0x5')](_0x210f62,_0x7b2357);};}for(const e in events){if(typeof events[e]!=='undefined'){const event=events[e];Plugin[_0x208610('0x2')](e,emitEvent(event));}}module[_0x208610('0x0')]=PluginEvents;