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
17
votes
7 answers

Javascript eventemitter multiple events once

I'm using node's eventemitter though other event library suggestions are welcomed. I want to run a function once if several events are fired. Multiple events should be listened to, but all of them are removed if any one of the events fires.…
Harry
  • 52,711
  • 71
  • 177
  • 261
16
votes
1 answer

Nodejs: use eventEmitter object globally

Lets say I have 3 exposed functions: user, posts, articles all of which needs to emit messages to a file called mediator where all of the events are set. Currently I'm have trouble doing so In the mediator file i have something like so: var…
user240993
15
votes
3 answers

TypeError: instance[output.propName].subscribe is not a function

I'm trying to emit a event from child to parent component. Parent: parent.ts onChangeUpload(event){ console.log('event'); console.log(event); } Child: @Output() uploadEmit:…
user3516604
  • 347
  • 3
  • 9
15
votes
4 answers

Angular 4: `ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked

Every EventEmiiter in my child module gives this error and I can't find a fix for this. ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'true'. Current value: 'false'. This is what triggers…
Nicolas
  • 4,526
  • 17
  • 50
  • 87
14
votes
5 answers

Angular Two-Way Data Binding and Watching for Changes in Parent Component

It seems there is no way to watch changes in the parent component when using two-way data binding. I have a custom input component for collecting a tag list. Two-way data binding is setup and working between this component and its parent. // the…
14
votes
2 answers

Using async in event emitter

I am being challenged trying to make an async call inside an event. Here's the code from Nodemailer - I've added the line where I need to make an async call: let transporter = nodemailer.createTransport({ SES: new aws.SES({ apiVersion:…
cyberwombat
  • 38,105
  • 35
  • 175
  • 251
14
votes
5 answers

NodeJS wait for callback to finish on event emit

I have and application written in NodeJS with Express and am attempting to use EventEmitter to create a kind of plugin architecture with plugins hooking into the main code by listening to emitted events. My problem comes when a plugin function makes…
Stuart
  • 866
  • 1
  • 8
  • 7
13
votes
2 answers

Angular 6 - MatDialog - EventEmitter - share object to parent component from MatDialog

Right now able to communicate between two components. but don't know how to pass user (selected) entered value as Object via event emitter from MatDialog component to the parent component. Here I want to pass selected option value and text area…
13
votes
1 answer

Angular ObjectUnsubscribedError while resubscribe

I'm getting the following error while trying to subscribe in the second time to an EventEmitter after that ngOnDestroy was invoked and called unsubscribe: ngOnInit() { this.route.params.subscribe(params => { …
Or Yaacov
  • 3,597
  • 5
  • 25
  • 49
13
votes
3 answers

Detect change in child component's variable triggered by parent angular 2

I have 2 files. app.ts and Child.ts I am sending a variable from app to child and I want to detect any change in the variable and show data accordingly. I am not able to detect changes in a variable. Any Help? I have attached Plunker Link and I have…
amansoni211
  • 889
  • 2
  • 13
  • 30
13
votes
3 answers

Angular2 EventEmitter and preventDefault()

Is there a way in Angular2 to somehow prevent the default for events using the EventEmitter? I have the following scenario: import {Component, Output, EventEmitter} from 'angular2/core' @Component({ selector: 'my-component', template: `
seraph
  • 351
  • 1
  • 3
  • 12
12
votes
2 answers

What are the differences between EventEmitter, EventTarget and EventDispatcher

I'm trying to learn implementations of Observer Pattern. EventEmitter/EventTarget/EventDispatcher are one implementation of Observer Pattern but I wonder the differences between these three. Any help would be appreciated?
uzay95
  • 16,052
  • 31
  • 116
  • 182
12
votes
1 answer

how to resolve a react native EventEmitterListener warning

I am using a event emitter to communicate between a map component and the toolbar. Note* I am using this same code in other parts of my app without issue. The error I am getting is : Warning: setState(...): Can only update a mounted or mounting…
texas697
  • 5,609
  • 16
  • 65
  • 131
12
votes
1 answer

Golang events: EventEmitter / dispatcher for plugin architecture

In Node.js I was able to make a WordPress clone rather easily using the EventEmitter to replicate and build a hooks-system into the CMS core, which plugins could then attach to. I now need this same level of extensibility and core isolation for my…
Dac0d3r
  • 2,176
  • 6
  • 40
  • 76
11
votes
2 answers

EventEmitter in angular services, good or bad?

I was using EventEmitter and @Output in Angular services, today one of the colleagues mentioned it's not a good practice. I found this post mentioning it's a bad practice and it seems mostly is personal opinion, and this answer is mentioning it's OK…
Reza
  • 18,865
  • 13
  • 88
  • 163
1 2
3
63 64