Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow message handlers to be registered dynamically #1992

Merged

Conversation

sammacbeth
Copy link
Collaborator

Description:

Adds an explicit default export from message-handlers.js that contains the default set of message handlers. We then also export a function that allows new handlers to be registered.

This will enable us to move handlers out of the central message handler file, and register handlers per-feature.

@sammacbeth sammacbeth requested a review from kzar May 22, 2023 07:33
Copy link
Collaborator

@kzar kzar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, splitting the message handlers out of this file is something I hoped we'd do and this approach seems pragmatic.

Perhaps add a comment at the top of message-handlers.js (or above the list of default handlers) to advise folks to use registerMessageHandler() in their feature's code instead though. (And maybe to explain that we're migrating away from these default handlers all living in this file.)

@sammacbeth sammacbeth force-pushed the 202305/dynamic-message-handlers branch from 24faeae to bb1ba8b Compare May 23, 2023 06:46
@sammacbeth sammacbeth merged commit 70628fc into duckduckgo:main May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants