Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nodejs/node-v0.x-archive
base: ac9cf002524d
Choose a base ref
...
head repository: nodejs/node-v0.x-archive
compare: c9d93f34311c
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Nov 12, 2013

  1. events: don't call once twice

    Emitting an event within a `EventEmitter#once` callback of the same
    event name will cause subsequent `EventEmitter#once` listeners of the
    same name to be called multiple times.
    
        var emitter = new EventEmitter();
    
        emitter.once('e', function() {
          emitter.emit('e');
          console.log(1);
        });
    
        emitter.once('e', function() {
          console.log(2);
        });
    
        emitter.emit('e');
    
        // Output
        // 2
        // 1
        // 2
    
    Fix the issue, by calling the listener method only if it was not
    already called.
    timrwood authored and indutny committed Nov 12, 2013
    Copy the full SHA
    c9d93f3 View commit details
    Browse the repository at this point in the history