EventsRouter
EventsRouter
Router for discovering and managing event handler files in a directory structure. Events are represented by directories, and handlers are files within those directories.
new EventsRouter(options)
Parameter | Type | Optional | Description |
---|---|---|---|
options | EventsRouterOptions | ❌ | Configuration options for the router |
Properties
public entrypoint: any
Get the entrypoint directory path
Methods
public clear(): void
Clear all parsed events
public isValidPath(): boolean
Checks if the entrypoint path is valid
public match(event): null | ParsedEvent
Find a parsed event by its name
Parameter | Type | Optional | Description |
---|---|---|---|
event | string | ❌ | Name of the event to find |
public reload(): Promise<EventsTree>
Reload and re-scan the entrypoint directory for events
public scan(): Promise<EventsTree>
Scan the entrypoint directory for events and their handlers
public toJSON(): EventsTree
Convert the internal events map to a plain object