GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Minor bug in the example from 'Inheriting from EventEmitter' section · Issue #285 · nodejs/nodejs.org

Minor bug in the example from 'Inheriting from EventEmitter' section #285

New issue
Copy link
New issue
Copy link
Closed
Closed
Minor bug in the example from 'Inheriting from EventEmitter' section#285
Copy link

Description

@ManasJayanth
ManasJayanth
opened on Oct 26, 2015
Issue body actions

Inheriting from EventEmitter section requires events and incorrectly assigns to EventEmitter object.

const EventEmitter = require('events');

It should be

const EventEmitter = require('events').EventEmitter;

Even while introducing EventEmitter class, it mentions var EventEmitter = require('events'); which should have been var EventEmitter = require('events').EventEmitter;

Run the code otherwise complains TypeError: Object prototype may only be an Object or null, which is understandable as object returned by simply requiring events does not have prototype property.

Activity

  1. evanlucas commented on Oct 26, 2015

    @evanlucas
    evanlucas
    on Oct 26, 2015
    Contributor
    More actions

    const EventEmitter = require('events') is actually the correct way of doing this now in v4.x

    Refs: nodejs/node#3509

  2. evanlucas
    closed this as completedon Oct 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.