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
1 answer

NodeJS custom class extending EventEmitter and require

Can somebody explain me why this following code don't work : i have a EventManager class : const events = require('events') class EventManager extends events.EventEmitter { constructor() { super() } } const instance = new…
Rav87
  • 57
  • 7
0
votes
2 answers

Node.js: Sharing an object between multiple files

I want one or more file to emit event(s) and multiple other files to listen to it. They should share the same instance. This what I've tried to do To test the code, I have 3 files eventEmitter.js - this creates a new EventEmitter object and…
am3
  • 681
  • 2
  • 12
  • 30
0
votes
1 answer

TypeScript | JavaScript | Angular 2 | @Output vs @Input

Whyyyyyyyyyyyyyyy? Dear Reader, I've searched high and low, but nobody can explain this without a huge leap of faith to just say, "Here are the effects!", or "This is how you do that! Don't ask why!" The issue class ChildComponent { @Output…
Cody
  • 9,785
  • 4
  • 61
  • 46
0
votes
1 answer

Angular 2: event emitting between sibling component

In my Angular 2 project I want event communication between sibling component and I have read some articles ans follow some question on stackoverflow on this topic and now finally I am using SERVICES EMITTING EVENTS USING RXJS as mentioned in this…
Shams Tabraiz Alam
  • 111
  • 1
  • 2
  • 12
0
votes
0 answers

nodejs: Cannot interact with data from websocket using eventEmitter

this is my first so be gentle. I am streaming data from a site using this: "use strict"; const ws = require('ws') const w = new ws('wss://website') w.on('message', (msg) => console.log(msg)) let msg = JSON.stringify({ …
bobby
  • 1
0
votes
2 answers

Angular2: EventEmitter based service too many calls

So I have an EventEmitter service that I want to use in order to share data between components, here is the code import { Injectable, EventEmitter } from '@angular/core'; @Injectable() export class ObservableService { data = []; …
Majesty
  • 2,097
  • 5
  • 24
  • 55
0
votes
1 answer

Angular2: Passing data between sibling components through routers?

I'm new to Angular2. I've been learning what I have mainly though the official docs, a slightly outdated udemy course by Mosh, and a book called ng-book2. What I have is a form that always exists on the (top of the) page. Underneath it is a listing…
0
votes
3 answers

Angular 2: Displaying icons in navbar on authentication

My component structure looks roughly like this. My app component has a nav bar and router outlet. The nav bar has logo, some generic links and some specific links to be shown on user login and authentication only. The router outlet loads the home…
Shilpa Nagavara
  • 1,055
  • 2
  • 16
  • 31
0
votes
2 answers

how to intergate eventemitter3 in CycleJs

pixijs use eventemitter3 for handler sprites events. for example sprite.on('mousedown', onDown), i am wondering how to make a driver in order to handlering events listening sprites.can any one show me some point?
蓝梓文
  • 1
  • 1
0
votes
1 answer

Can I use this.on to listen to events in EventEmitter? Looking for correct usage of Eventmitter in class in javascript

I am using EventEmitter3 which is an event module in my javascript code. It works just like the event module in Node.js. But I am facing problems to use it correctly. Normally if I use the module in my code, I would create an object of the…
newguy
  • 5,668
  • 12
  • 55
  • 95
0
votes
1 answer

Stream data from an EventEmitter class - NodeJS

I'd like to know if is it possible to create a readable stream in some way with the data emitted by an EventEmitter. For example, I have a RandomNumberGenerator that inherits from EventEmitter that has this function: emitData: => clearTimeout…
0
votes
1 answer

Angular 2 combine two EventEmitters

I am making an app with Angular 2 where i have two components each having its own EventEmitter. One EventEmitter is fired when bunch of checkboxes are checked/unchecked and the other is fired when a search keyword is entered. The search bar is in…
Hassan
  • 2,308
  • 5
  • 21
  • 31
0
votes
1 answer

Javascript - TypeError: listener must be a function

Yet another 'listener must be a function' error. I double checked all my parameters, checked for correct syntax etc but still can't find where the problem is: Here are my snippets of code. in login.js: global.eventEmitter =…
0
votes
2 answers

Mocha/Chai: How to perform async test of something that didn't happen?

I am trying to write a short mocha/chai Node test for some async process, expecting it to ignore irrelevant input. It basically looks like this (compared to the test of relevant input). The problem is how do I write the second test? It's an async…
Sagi Mann
  • 2,967
  • 6
  • 39
  • 72
0
votes
1 answer

Allow only certain events

Is there a way to only allow certain events in a custom eventEmitter? For example, if I have something like this everything works as expected: const EventEmitter = require('events'); class myEvent extends EventEmitter { constructor() { …
Christoph Pohl
  • 325
  • 5
  • 19