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
3 answers

What's the most efficient 'watch' js that watch same obj/property from multiple places?

I go for data-binding using ECMA7 Object.observe or Mozilla Object.watch instead of eventEmitter of node. For Object.observe, I cannnot find any implementation around for android browser compatiblity. They basically must use setTimeout polling, so I…
user1028880
0
votes
0 answers

Nodejs: My eventEmitter won't emit events from inside its constructor

I'm having some trouble with a custom event emitter in Nodejs. I'm pretty sure I've created the eventemitter correctly, since I can fire and catch events on its instances. However, none of the events in its constructor are being fired. They all…
0
votes
1 answer

Javascript closure and events

I am facing following issue: I am calling in foreach cycle following browse function. When the rb.wsc.browse(symbol) is called the program do some WebSocket request and when the message is returned the event is emmited. The problem is that I always…
Ondřej Severa
  • 359
  • 5
  • 12
0
votes
0 answers

Replacing original EventEmitter with custom one

Consider I want to use EventEmitter2, or some implementation of EventEmitter of my own. However, if I just do EventEmitter = MyEventEmitter, it only helps for explicit inheritance that happens after this declaration, but obviously won't change…
toriningen
  • 7,196
  • 3
  • 46
  • 68
0
votes
1 answer

EventEmitter JavaScript

This code block emits an event and passes through an integer: function executeEvent() { // here you could use the event bus to chuck the pfio event to the pfio event api..... if (eventQueue.length > 0) { for (var i = 0; i <…
Callum Linington
  • 14,213
  • 12
  • 75
  • 154
0
votes
2 answers

Is it bad practice to emit events with callbacks as arguments in node?

Is it bad practice to emit events with callbacks as arguments in node? var someonesListened = self.emit('doSomething', param, callback); if (!someonesListened) { callback(); } // in another module somewhere this.on('doSomething',…
Tim Fairbrother
  • 928
  • 2
  • 9
  • 20
0
votes
0 answers

Is it possible to pass For loop inside Event emitter

In the below code, if I remove event emitter part the function is working properly (only the commented code). With event emitter what Im doing wrong here? Im getting Error TypeError: Cannot set property 'undefined' of undefined function…
0
votes
1 answer

Implementing eventEmitter in my own class in nodejs

i am writing a socket class and it should emit 'socketConnected' event when the socket is connected.For that i have done this. Socket.prototype.connectEmitter = function(client){ console.log("Connected"); console.log(client); …
bring2dip
  • 886
  • 2
  • 11
  • 22
0
votes
1 answer

show folders using node.js and handlebars.js

i want to show folders that i ahve aunder some directory, im using express3-handlebars. html code: {{gallery}} here what i have: res.render('pages/gallery', { title: 'גלריה', HomeActive:'', ContactActive:'', …
Boaz Hoch
  • 1,219
  • 1
  • 12
  • 36
0
votes
1 answer

EventEmitter - Why does the scope of this differ when adding a listener?

I have a custom EventEmitter object, which emits when messages are received. After receiving a message, I'll publish it to a message exchange from an object, which will use a callback defined from that same object. Sample of the exchange function…
matth
  • 6,112
  • 4
  • 37
  • 43
0
votes
2 answers

EventEmmitter: access the event from within the callback

Can I have access to the name of an event from within the callback which is executed when the event is triggered? Consider the following example, where I have the same callback (handleEvent)for two differenct events. Now I want to add a conditional…
balafi
  • 2,143
  • 3
  • 17
  • 20
0
votes
1 answer

Emitter inside emitter node.js

I have the code : var events = require('events'); var serialport = require("serialport"); var SerialPort = serialport.SerialPort; var serialPort; function SerialConnector(){ //EventEmitter constructor …
enesaltinok
  • 55
  • 1
  • 7
0
votes
1 answer

Event Emitter Memory Leak

I've read a bunch on this topic, but still don't understand the issue with my code (or the problem with my logic/understanding of what's actually going on). Can someone please explain what I'm missing? Basically, I've narrowed this problem down to…
joshula
  • 535
  • 1
  • 5
  • 19
0
votes
1 answer

Object inheriting from EventEmitter does not raise events

I am new to Node.js and am having trouble debugging an issue. I have created an object which acts as an event emitter, however, my callbacks don't get called when the event is emitted. I have defined my emitter as follows: var EventEmitter =…
Kartik
  • 160
  • 1
  • 7
0
votes
2 answers

require.js shim configuration for EventEmitter2

I'm new to require.js and trying to use RosLib.js on my page by loading it with require.js. RosLib.js has a dependency to EventEmitter2. So this is my code: require.config({ shim: { eventemitter: { exports: 'EventEmitter2' …
Stefan Profanter
  • 6,458
  • 6
  • 41
  • 73