Skip to main content

eventemitter2

PropertyValue
Packageeventemitter2
Versions Covered>=6.0.0
Contract Version1.0.0
Statusproduction
Last Verified2026-02-27
Maintainercorpus-team

Installation

npm install eventemitter2

Covered Functions

This contract covers 1 function(s):

EventEmitter2()

Creates EventEmitter2 instance

Import:

import { EventEmitter2 } from 'eventemitter2';

Postconditions

What happens after calling this function:

🔴 ERROR - eventemitter2-001

Condition: error event emitted without listener

Throws: Uncaught exception unless ignoreErrors configured

Required Handling:

Caller MUST attach error event listener

📖 Source


Example: Proper Error Handling

import eventemitter2 from 'eventemitter2';

async function example() {
try {
const result = await EventEmitter2(/* args */);
// Handle success
return result;
} catch (error) {
// Handle error according to contract postconditions
console.error('Error:', error);
throw error;
}
}

See Also