2023-03-12 20:31:29 +00:00
|
|
|
# Events
|
|
|
|
|
2023-03-19 16:00:50 +00:00
|
|
|
!!! info "Design Document"
|
2023-07-06 00:45:32 +00:00
|
|
|
This is a design document, explaining the design and vision for a HedgeDoc 2
|
|
|
|
feature. It is not a user guide and may or may not be fully implemented.
|
2023-03-19 16:00:50 +00:00
|
|
|
|
2023-03-12 20:31:29 +00:00
|
|
|
In HedgeDoc 2, we use an event system based on [EventEmitter2][eventemitter2].
|
2023-07-06 00:45:32 +00:00
|
|
|
It's used to reduce circular dependencies between different services and inform these services
|
|
|
|
about changes.
|
2022-09-24 16:52:02 +00:00
|
|
|
|
|
|
|
HedgeDoc's system is basically [the system NestJS offers][nestjs/eventemitter].
|
2023-07-06 00:45:32 +00:00
|
|
|
The config for the `EventEmitterModule` is stored in `events.ts` and
|
|
|
|
exported as `eventModuleConfig`. In the same file enums for the event keys are defined.
|
|
|
|
Each of these events is expected to be sent with an additional value.
|
2023-03-12 20:31:29 +00:00
|
|
|
In the enum definition a comment should tell you what exactly this value should be.
|
2022-09-24 16:52:02 +00:00
|
|
|
|
|
|
|
[eventemitter2]: https://github.com/EventEmitter2/EventEmitter2
|
|
|
|
[nestjs/eventemitter]: https://docs.nestjs.com/techniques/events
|