Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
emit (event, data, ctx) {
const disabled = ctx && ctx[SYNC] === false;
if (!service._serviceEvents.includes(event) || disabled) {
debug(`Passing through non-service event '${path} ${event}'`);
return this._emit(event, data, ctx);
}
const context = hooks.isHookObject(ctx)
? _.omit(ctx, 'app', 'service') : ctx;
debug(`Sending sync-out event '${path} ${event}'`);
return app.emit('sync-out', app.sync.serialize({
event, path, data, context
}));
}
});