
Security News
Rust 1.100 Will Add Dependency Cooldowns to Cargo
Rust 1.100 will add opt-in dependency cooldowns to Cargo, giving security scanners and maintainers time to catch malicious crate releases.
@eggjs/eventbus-plugin
Advanced tools
// plugin.js
export.teggEventbus = {
enable: true,
package: '@eggjs/eventbus-plugin',
};
// test/fixtures/apps/event-app/app/event-module/HelloService
@ContextProto({
accessLevel: AccessLevel.PUBLIC,
})
export class HelloService {
@Inject()
private readonly eventBus: EventBus;
hello() {
this.eventBus.emit('hello', '01');
}
}
// test/fixtures/apps/event-app/app/event-module/HelloLogger
@Event('helloEgg')
export class HelloLogger {
handle(msg: string) {
console.log('hello, ', msg);
}
}
// test/event.test.ts
import assert from 'assert';
import path from 'path';
import mm from 'egg-mock';
import { HelloService } from './fixtures/apps/event-app/app/event-module/HelloService';
import { HelloLogger } from './fixtures/apps/event-app/app/event-module/HelloLogger';
describe('test/eventbus.test.ts', () => {
let app;
let ctx;
afterEach(async () => {
await app.destroyModuleContext(ctx);
mm.restore();
});
before(async () => {
app = mm.app();
await app.ready();
});
after(() => {
return app.close();
});
it('msg should work', async () => {
ctx = await app.mockModuleContext();
const helloService = await ctx.getEggObject(HelloService);
let msg: string | undefined;
// helloLogger is in child context, should mock the prototype
mm(HelloLogger.prototype, 'handle', (m) => {
msg = m;
});
const eventWaiter = await app.getEventWaiter();
const helloEvent = eventWaiter.await('hello');
helloService.hello();
await helloEvent;
assert(msg === '01');
});
});
FAQs
tegg event plugin
The npm package @eggjs/eventbus-plugin receives a total of 0 weekly downloads. As such, @eggjs/eventbus-plugin popularity was classified as not popular.
We found that @eggjs/eventbus-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 10 open source maintainers collaborating on the project.

Security News
Rust 1.100 will add opt-in dependency cooldowns to Cargo, giving security scanners and maintainers time to catch malicious crate releases.

Security News
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.

Security News
Anthropic’s free OSS Scanner uses Mythos and other Claude models to find open source vulnerabilities and send maintainers reports with proposed fixes.