diff --git a/doc/api/events.markdown b/doc/api/events.markdown index e7470f37aa..fbc04a9623 100644 --- a/doc/api/events.markdown +++ b/doc/api/events.markdown @@ -162,3 +162,20 @@ added. This event is emitted *after* a listener is removed. When this event is triggered, the listener has been removed from the array of listeners for the `event`. + +### Inheriting from 'EventEmitter' + +Inheriting from `EventEmitter` is no different from inheriting from any other +constructor function. For example: + + 'use strict'; + const util = require('util'); + const EventEmitter = require('events').EventEmitter; + + function MyEventEmitter() { + // Initialize necessary properties from `EventEmitter` in this instance + EventEmitter.call(this); + } + + // Inherit functions from `EventEmitter`'s prototype + util.inherits(MyEventEmitter, EventEmitter);