Questions tagged [eventemitter]

An event emitter is a platform for triggering and listening for events.

An event emitter is a platform for triggering and listening for events. Different libraries offer different implementations and for different purposes.

960 questions
0
votes
0 answers

Angular2 EventEmitter Subscribe?

I've started to learn Angular2 yesterday and I'm stuck at understanding how to subscribe to an EventEmitter. I have my layout divided in 2 part Leaderboard that show players and CreatePlayer that create a new Player. I have a PlayerService that…
Vince
  • 1,279
  • 2
  • 20
  • 40
0
votes
1 answer

Flux Stores: Why extend EventEmitter.prototype?

Every offical Flux example I can find uses this pattern for creating a store: var MyStore = assign({}, EventEmitter.prototype, { ... }); I don't understand why we're assigning methods directly on the MyStore object when we could just inherit…
wolverdude
  • 1,583
  • 1
  • 13
  • 20
0
votes
1 answer

this.emit("ready") does nothing in node.js

I'm trying to write a simple library in node.js. Here's my library code, in a file called "index.js" in the "lib" folder: var util = require("util"); var EventEmitter = require("events").EventEmitter; util.inherits(Foo, EventEmitter); function…
Grayda
  • 1,870
  • 2
  • 25
  • 43
0
votes
1 answer

Node.js EventEmitter function error `listener must be a function` when `typeof` returns function - could be scope issue

I have an object which is being interacted with from a few different node.js modules. I want to have some of these modules be able to add eventListeners to the object. I have an events file where the event emitters are attached and removed. It…
pedalpete
  • 21,076
  • 45
  • 128
  • 239
0
votes
1 answer

node.js v0.12.x changes in EventEmitter ruins inheritance

There is some changes in node.js 0.12.x related to events module. This changes makes my code that extends EventEmitter class non-workable. Here is code that works fine in node.js v0.10.35: teh_emitter.js: var EventEmitter = require('events'); var…
registered
  • 50
  • 1
  • 6
0
votes
1 answer

Which events should I use for spawning a child process to ensure I always make a callback

I'm using node to wrap an executable and I'm using the spawn event emitter. See the docs here. There are multiple events to subsribe to. child = spawn("path/to/exe", args) child.on('close', exitNormally ) child.on('exit', exitNormally…
Neil
  • 5,179
  • 8
  • 48
  • 87
0
votes
1 answer

Jasmine: how to run series of tests after an event has triggered

I'm trying to run tests on my npm module. The code below will work if I comment out either of the 2 it blocks, but times out if I leave them both in as below. How can wait for "ready" before running my tests (I'd like to add more but they too need…
Simon H
  • 20,332
  • 14
  • 71
  • 128
0
votes
1 answer

has no method of emit in node.js

I made a simple example like below, and I got a error saying 'has no method of 'emit' ', what is the issue ? var events = require('events'); var EventEmitter = require('events').EventEmitter; var util = require('util'); var Door = function…
user824624
  • 7,077
  • 27
  • 106
  • 183
0
votes
1 answer

node.js events in router(emitter) and handlers(listeners)

My need is to generate custom events in router, that shall be based on the data that is coming from front-end. Like if the front-end object has handle_hello_world, then the router shall emit an event for handle_hello_world, so that the corresponding…
user3601166
  • 127
  • 2
  • 13
0
votes
1 answer

Not able to hook up listener on eventEmitter

I'm trying to setup email notification using node's events module. I'm not able to make it work, as in its not doing when email event is emitted. Not sure whats wrong. Could you please help me debug this code. Thanks in advance! email.js var express…
Sudhakar
  • 2,904
  • 8
  • 33
  • 47
0
votes
0 answers

EventEmitter memory leak in node 10.20

I'm trying to do concurrent hits to my node server and am getting the below error node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit. Trace at…
Stack s
  • 113
  • 2
  • 2
  • 12
0
votes
1 answer

Creating particular loop behavior

While creating an internal EventEmitter for my project, I became curious how to produce a particular loop iteration behavior for attached event handlers. Here's a demonstration of my concern: MyEventEmitter.prototype.emit = function (name, event) { …
Patrick Roberts
  • 49,224
  • 10
  • 102
  • 153
0
votes
1 answer

Do event emitters always fire one after the other ,in the order they have been emitted

var events = require('events'); var eventEmitter = new events.EventEmitter(); …
theDarkerHorse
  • 109
  • 1
  • 1
  • 15
0
votes
1 answer

Strange behaviour coding with events

Currently working on an application that does quite a bit of database work, and thought that one smart way of getting around this should be to use events. So I set up a events emitter for the application to use, and then using this as a way to…
vrghost
  • 1,084
  • 2
  • 19
  • 42
0
votes
0 answers

EventEmitter memory leak on running MEAN app on AWS

I am working on a MEAN Stack based application and when i try to host the project on AWS then every thing goes properly and when i run the app then the server started on PORT 80 in command promt. when i try to run the provided ip on browser then it…
ashishkumar148
  • 975
  • 1
  • 10
  • 26