Built motion from commit ecdc8e66766c75b1b08288b0ea13eb12d42606b4. Version 3.0.0...
[motion-next.git] / server / api / notification / notification.events.js
1 const a462_0x1961=['emit','exports','remove','Notification','setMaxListeners'];(function(_0x19a48f,_0x1961aa){const _0x21b712=function(_0x38625b){while(--_0x38625b){_0x19a48f['push'](_0x19a48f['shift']());}};_0x21b712(++_0x1961aa);}(a462_0x1961,0x8c));const a462_0x21b7=function(_0x19a48f,_0x1961aa){_0x19a48f=_0x19a48f-0x0;let _0x21b712=a462_0x1961[_0x19a48f];return _0x21b712;};const _0x17808a=a462_0x21b7;'use strict';const EventEmitter=require('events'),Notification=require('../../mysqldb')['db'][_0x17808a('0x3')],NotificationEvents=new EventEmitter();NotificationEvents[_0x17808a('0x4')](0x0);const events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x17808a('0x2')};function emitEvent(_0x38625b){return function(_0xc75d12){const _0x149f9a=a462_0x21b7;NotificationEvents[_0x149f9a('0x0')](_0x38625b+':'+_0xc75d12['id'],_0xc75d12),NotificationEvents[_0x149f9a('0x0')](_0x38625b,_0xc75d12);};}for(const e in events){if(typeof events[e]!=='undefined'){const event=events[e];Notification['addHook'](e,emitEvent(event));}}module[_0x17808a('0x1')]=NotificationEvents;