Private ReadonlyhandlersProtected ReadonlyloggerLogger instance for this service
Protected ReadonlynameService name for logging
Gets the current service state.
ProtectedassertDisposes the service and cleans up resources. Ensures disposal only happens once.
Gets all registered message types.
Array of registered message types
Checks if a handler is registered for a message type.
The message type to check
True if a handler is registered
Initializes the service. Ensures initialization only happens once and tracks state.
ProtectedonDisposal hook - clears all handlers.
ProtectedonInitialization hook (no-op for this service).
Registers a message handler for a specific message type.
The message type to handle (e.g., 'select-runtime')
The handler function to call
Routes a message to the appropriate handler. If no handler is registered, logs a warning and continues.
The message from the webview
The document context
Unregisters a handler for a message type.
The message type to unregister
True if a handler was removed
Document message router service. Provides centralized message routing with handler registration pattern. Eliminates code duplication between NotebookProvider and LexicalProvider.
Example