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

Can't get token.remove() working in Facebook Emitter

Any idea why Facebook emitter is not working for token.remove() call below: Console: $ node main.js 5 10 /Users/carlf/Documents/dev/test/emitter/emit-node.js:21 token.remove(); ^ TypeError: undefined is not a function My Code: var…
Giant Elk
  • 5,375
  • 9
  • 43
  • 56
0
votes
1 answer

Trying to get Facebook Emitter working

I get the following error when trying Facebook emitter from node command line. I tried removing {} around EventEmitter without Bable, then with Bable and the code below. EventEmitter Setup, as per: Using Babel. How to use Babel with your tool of…
Giant Elk
  • 5,375
  • 9
  • 43
  • 56
0
votes
2 answers

What is the reason for cloning the listeners array in nodejs/events.js' emitMany function?

The function code (source code on github): function emitMany(handler, isFn, self, args) { if (isFn) handler.apply(self, args); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len;…
marzelin
  • 10,790
  • 2
  • 30
  • 49
0
votes
1 answer

Angular 2 ES6/7 Eventemitter update other Component

i want to share data between components, so im implemented a Service which has an EventEmitter. My Service looks like this: @Injectable() export class LanguageService { constructor() { this.languageEventEmitter = new EventEmitter(); …
orbatschow
  • 1,497
  • 2
  • 13
  • 26
0
votes
1 answer

Angular2 Unit test Service that Emit value at Constructor Time

Writing a unit test for a component, that uses a Service with an emit inside the constructor, like this: @Injectable() export class Service1 { public onService1Done: EventEmitter = new EventEmitter(); public constructor(...) { …
AntuJitsu
  • 119
  • 1
  • 9
0
votes
1 answer

Why do I need to wrap my EventEmitter's on function when passing/exposing it?

My application communicates to devices using several different mechanisms, such as serial (i.e. like USB CDC / Virtual COM port) and TCP (i.e. like telnet), and I've tried to encapsulate / hide / abstract this functionality with a higher-level…
jacobq
  • 11,209
  • 4
  • 40
  • 71
0
votes
0 answers

React Native unmount scene listening to event

I am working on mobile app with React Native and have discovered this weird behaviour using EventEmitter in my project. I am using Flux. In my Scene (Component) I listen to Event as seen below in code: Component: componentWillMount(){ …
George Mylonas
  • 704
  • 6
  • 16
0
votes
1 answer

Different ways of extending class in Javascript

I'm reading this article on extending the EventEmitter class in node and there's a small part that I don't understand: Door.prototype.__proto__ = events.EventEmitter.prototype; I've looked up several articles on how this is supposed to work but…
blop
  • 31
  • 1
  • 7
0
votes
1 answer

Node EventEmitter Not Giving Anticipated Results

I have a book.js and server.js file. I run node ./server.js and the server begins to run. I open Google Chrome and open developer console, and inpute book.rate(10), and my emit does not happen anywhere. Maybe I am not understanding eventemitters.…
christopher clark
  • 2,026
  • 5
  • 28
  • 47
0
votes
2 answers

Event emitter causing memory leak

I've seen that if I press F5 during 15seconds I got a memory leak problem : (node) warning: possible EventEmitter memory leak detected. 11 change listeners added. Use emitter.setMaxListeners() to increase limit. Is it possible to avoid that ? I'm…
TLd
  • 602
  • 8
  • 23
0
votes
1 answer

Node event emitter with condition

I've node app which raise event when I can run other logic, for example server.js will emit event when its up (just for example...),then I've logic which should be run after this event was raised First File server.js -> runProcess -> finish ->…
user4209821
0
votes
1 answer

Create custom event in node js and update custome obj

I've node app which listen to some events, I want to create my custom events which will update some object with property from this event, how its recommended to do that? Lets say I've two files one with this following events (regular event) and this…
user4445419
0
votes
2 answers

Create events object after some data was

I've several events which I need to listen to with additional event and pass object: const spawn = require('child_process').spawn; const ls = spawn('ls', ['-lh', '/usr']); ls.stderr.on('data', (data) => { myObj.data = true //here I need to…
user4209821
0
votes
2 answers

Flux eventemitter

I am currently trying out the FLUX design pattern and I have stumpled upon an issue. In this project I am also using ReactJS to go with it. It is working fine to a point where it is almost done, but screws up. So I am starting the function(s) with a…
DCBN
  • 65
  • 2
  • 8
0
votes
1 answer

Returning an object that can only receive events but not emit

Apologies if this is a duplicate, I searched the internet for hours and came up empty so I decided to post here. I am developing a module for node.js that would have to deal with socket connections. I want to create a function that returns an object…
Taavi
  • 165
  • 1
  • 1
  • 8