
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
@types/events
Advanced tools
TypeScript definitions for events
The @types/events package provides TypeScript type definitions for the Node.js 'events' module, which is used for handling events in an application. This package does not contain functionality by itself but offers type annotations for TypeScript developers to ensure type safety and better development experience when working with event-driven programming in Node.js.
EventEmitter Type Definitions
Provides type definitions for creating and using an EventEmitter to handle custom events. The code sample demonstrates how to create an EventEmitter, subscribe to an event with a specific type of listener function, and emit an event.
import { EventEmitter } from 'events';
const emitter: EventEmitter = new EventEmitter();
emitter.on('event', (message: string) => {
console.log(`Received message: ${message}`);
});
emitter.emit('event', 'Hello World!');
EventEmitter3 is a high-performance EventEmitter. It provides similar functionality to Node.js's native EventEmitter from which @types/events derives its types. EventEmitter3 is often chosen for its performance optimizations and is compatible with a broader range of environments, including those where native EventEmitters are not available.
This package is another alternative to the native EventEmitter, offering similar functionalities with additional features like namespaces, wildcards, and times to listen. It does not have built-in TypeScript support, unlike @types/events, but can be more flexible in complex event handling scenarios.
npm install --save @types/events
This package contains type definitions for events (https://github.com/Gozala/events).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/events.
export type Listener = (...args: any[]) => void;
export class EventEmitter {
static listenerCount(emitter: EventEmitter, type: string | number): number;
static defaultMaxListeners: number;
eventNames(): Array<string | number>;
setMaxListeners(n: number): this;
getMaxListeners(): number;
emit(type: string | number, ...args: any[]): boolean;
addListener(type: string | number, listener: Listener): this;
on(type: string | number, listener: Listener): this;
once(type: string | number, listener: Listener): this;
prependListener(type: string | number, listener: Listener): this;
prependOnceListener(type: string | number, listener: Listener): this;
removeListener(type: string | number, listener: Listener): this;
off(type: string | number, listener: Listener): this;
removeAllListeners(type?: string | number): this;
listeners(type: string | number): Listener[];
listenerCount(type: string | number): number;
rawListeners(type: string | number): Listener[];
}
These definitions were written by Yasunori Ohoka, and Shenwei Wang.
FAQs
TypeScript definitions for events
The npm package @types/events receives a total of 1,523,401 weekly downloads. As such, @types/events popularity was classified as popular.
We found that @types/events demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.