🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

najm-event

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

najm-event

Event .

latest
npmnpm
Version
1.1.15
Version published
Maintainers
1
Created
Source

najm-events

Optional events (event bus) plugin for Najm framework with decorator-based event handling and async event emission.

Installation

bun install najm-events

Usage

import { On, Events } from 'najm-events';

// Listen to events with the @On decorator
@Service()
class UserService {
  @On('user.created')
  async handleUserCreated(data: any) {
    console.log('User created:', data);
  }
}

// Inject event methods using @Events decorator
@Controller('/api/users')
class UserController {
  @Events() private events!: any;

  @Post('/create')
  async createUser(@Body() userData: any) {
    // Create user logic here
    const user = await this.userService.create(userData);
    
    // Emit event
    this.events.emit('user.created', user);
    
    return user;
  }
}

Features

  • Decorator-based event handling with @On() and @Events()
  • Async event emission with error handling
  • Integration with Najm's DI system
  • Event statistics and management

FAQs

Package last updated on 21 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts