mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-25 15:31:21 +00:00
docs: add documentation about events
Signed-off-by: Philip Molares <philip.molares@udo.edu> Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
297469b49e
commit
5dffe35ea1
2 changed files with 11 additions and 2 deletions
9
docs/content/dev/events.md
Normal file
9
docs/content/dev/events.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
In HedgeDoc we use an event system based on [EventEmitter2][eventemitter2]. It's used to reduce circular dependencies between different services and inform these services about changes.
|
||||
|
||||
HedgeDoc's system is basically [the system NestJS offers][nestjs/eventemitter].
|
||||
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. In the enum defintion a comment should tell you what exactly this value should be.
|
||||
|
||||
[eventemitter2]: https://github.com/EventEmitter2/EventEmitter2
|
||||
[nestjs/eventemitter]: https://docs.nestjs.com/techniques/events
|
||||
|
|
@ -15,6 +15,6 @@ export const eventModuleConfig = {
|
|||
};
|
||||
|
||||
export enum NoteEvent {
|
||||
PERMISSION_CHANGE = 'note.permission_change',
|
||||
DELETION = 'note.deletion',
|
||||
PERMISSION_CHANGE = 'note.permission_change' /** noteId: The id of the [@link Note], which permissions are changed. **/,
|
||||
DELETION = 'note.deletion' /** noteId: The id of the [@link Note], which is being deleted. **/,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue