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

Tell parent component to delete child from that same child component

I have an Angular parent component that creates an array containing several child components based on a value (e.g., 1 ParentComponent creates 10 ChildComponents). The ChildComponent has HTML that displays several buttons, including a delete button.…
Roka545
  • 3,404
  • 20
  • 62
  • 106
0
votes
1 answer

Running multiple instances of one function simultaneously

Using WebSocket I receive updates which i want to store in a mongodb database. Each time there is an update an event with data is emitted. The data is an array of updates, which need to be processed one by one before putting them in the database.…
Alex
  • 1
  • 1
0
votes
0 answers

Angular component does not react on boolean property changes

I have subscription on event emitter in my component initialization ngOnInit(): void { this.linksService.droppableZoneActivation.subscribe( (activate: boolean) => { this.activated = activate; } …
0
votes
1 answer

Event Emmiter returns error 500 with express.js, it only gets 200 response over one event

On my project I have some sore of function that emmits some events: const express = require('express'); const EventEmitter = require('events'); /*Initialize Body parsers etc etc*/ const emmiter=new EventEmitter(); const…
Dimitrios Desyllas
  • 9,082
  • 15
  • 74
  • 164
0
votes
3 answers

Angular @Output: Can we detect if function is done when emitting?

I have an Angular Component with an Output. When I emit an event to this output, an async function will be called (this function is outside of the component). Inside the component, I'd like to know when this outside function has finished. Is there…
PX Developer
  • 8,065
  • 7
  • 42
  • 66
0
votes
1 answer

How to require one module in the other for using event emitters?

I have an express server file like this const express = require('express') const app = express() app.get('/', (req, res) => res.send('Hello World!')) app.listen(3000, () => console.log('Example app listening on port 3000!') And I have a file for…
Abhishek Yadav
  • 342
  • 1
  • 2
  • 16
0
votes
1 answer

Can't set headers after they are sent when using EventEmitter

Here is my code: const cluster = require('cluster'); const express = require('express'); const bodyParser = require('body-parser'); const cors = require('cors'); const queueMgr = require('./lib/queueManager'); const eventEmitter = new…
Ayush Gupta
  • 8,716
  • 8
  • 59
  • 92
0
votes
1 answer

Unit test promise result inside Event Listener in Node

I have the following code that I want to test. emitter.on("request", function(req, res) { mock_finder.getMockedResponse().then((mockedResponse) => { res.end(mockedResponse); }); }); Then, I have this unit test. it("should return…
alayor
  • 4,537
  • 6
  • 27
  • 47
0
votes
1 answer

Can you subscribe to events on an embedded view in Angular?

I am trying to pass data/events up through a chain of nested components using EventEmitters. However I think the way I solved one problem may be preventing this from happening. I am creating an embedded view on one of the components so it doesn't…
333Matt
  • 1,124
  • 2
  • 19
  • 29
0
votes
1 answer

Parent/Child Component Interaction - Return values using EventEmitter angular2

1) I have a child component (CounterComponent) that emits an event using @Output 2) The child component also has an Input parameter callBackCancelled. 3) The parent component (AppComponent) sets the callBackCancelled value to "true" but in the child…
muth
  • 81
  • 6
0
votes
2 answers

Get the function passed to a eventEmitter Angular 4

Is it possible to get the function passed to the Event Emitter? I have a component and i pass a function to an event emitter like this: and in my Component i have the @Output to recieve the…
Hely Saul Oberto
  • 577
  • 1
  • 10
  • 22
0
votes
0 answers

Socket.io connects but does not receive message on the client

I implemented the server and client with socket.io and the server is working correctly, when some client connects it logs me in, but when I emit an event it does not arrive at the client, it follows the code to analyze: And the console.log from…
felipesmendes
  • 47
  • 2
  • 11
0
votes
1 answer

How to make an emitter ignore case?

bot.on('message', message => { var str = (message.content.indexOf("swear")) if (str != -1){ var Pottymouth = message.guild.roles.find('name', 'Pottymouth') message.channel.send("Woah there, " + message.author +…
0
votes
0 answers

Node.js EventEmitter: Can I bind and listen for events on methods?

I've been practising the following structure: class ProductService extends EventEmitter { constructor() { super() } getProductById(id) { this.emit('beforeCall', { method: 'getProductById', params: { id }}) return…
Trav L
  • 14,732
  • 6
  • 30
  • 39
0
votes
0 answers

Unable to extend class with EventEmitter correctly when used as an Injectable

I am using eventemitters in class A and extending it to class B. But when I try to trigger the event from class B, it does not identify the event. Both class A and class B are injectables. I have to work around the situation by injecting the class A…
Gary
  • 2,293
  • 2
  • 25
  • 47