yak0 / nest-event Goto Github PK
View Code? Open in Web Editor NEWEvent handling with decorators for NestJS Framework
Home Page: https://twitter.com/jsdragonsdev
License: MIT License
Event handling with decorators for NestJS Framework
Home Page: https://twitter.com/jsdragonsdev
License: MIT License
Is it possible to strongly type the events in much the same way as nest-emitter?
UnhandledPromiseRejectionWarning: TypeError: emiterInstance.on is not a function
Please update the @nestjs/common to fix the axios vulnerabilities (GHSA-cph5-m8f7-6c5x).
@nestjs/common have merged it into the core now: nestjs/nest#8030
For someone who needs a quick fix until this gets resolved:
"resolutions": { "axios": "0.21.4" },
I am having issues using nest-event. I have NestEventModule imported in app.module
imports: [ NestEventModule, ... ]
Then I am injecting it in my service:
constructor(private nestEvent: NestEventEmitter)
And finally I emit an event:
this.nestEvent.emit('TESTEMIT');
This emit is triggered when I do a GET request to my API.
But all I get is this error:
error: ┏ Cannot read property 'has' of undefined: +6ms
error: ┃ [1] TypeError: Cannot read property 'has' of undefined
error: ┃ [2] at NestEventEmitter.emitter (/home/user/code/core/node_modules/nest-event/nest-event-emitter.js:42:42)
error: ┃ [3] at NestEventEmitter.emit (/home/user/code/core/node_modules/nest-event/nest-event-emitter.js:24:35)
error: ┃ [4] at UserService.test (/home/user/code/core/artifacts/dist/src/app/modules/user/services/user.service.js:45:24)
error: ┃ [5] at UserEventsController.readAll (/home/user/code/core/artifacts/dist/src/app/modules/user/controllers/user.events.controller.js:38:22)
error: ┃ [6] at /home/user/code/core/node_modules/@nestjs/microservices/context/rpc-context-creator.js:44:33
error: ┗ [7] at processTicksAndRejections (internal/process/task_queues.js:93:5)
It happens right here: if (!this.nestEvent.getEmitters().has(emitter)) {
I tried creating different emitter classes with @emitter() decorator but it doesn't help.
I also tried executing configure() method manually as I've seen in the code it is used for setting emitters in a Map, also doesn't help.
Any suggestions? Thanks in advance
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.