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

Code now reflects newer versions of browser.menus API #523

Merged
merged 2 commits into from
Apr 21, 2023
Merged

Code now reflects newer versions of browser.menus API #523

merged 2 commits into from
Apr 21, 2023

Conversation

aug-dev
Copy link
Contributor

@aug-dev aug-dev commented Apr 17, 2023

Description

The background script of menu-demo was updated to use a newer version of the browser.menus API, so the code doesn't need to create an extra variable checkedState to keep track of menu item state.

Code contains more details.

Motivation

The previous version of the code contained a comment saying that a feature is not supported by the Firefox version of the browser.menus API.

Since now it is supported, I think it should be implemented.

This way, new developers learning the API won't be confused by the information mismatch in the documentation and the example extension.

Awesome extension by the way, it helped me a lot to understand this API.

Pedro Celeste added 2 commits April 17, 2023 11:51
In the previous version of this extension, the author used a comment to
explain that the `browser.menus.onClicked.addListener` event listener
doesn't pass the current check state of a checkbox menu.

To solve this, an additional variable checkedState was used to keep
track of the current value of the context menu.

But now, this function is supported by the menus API in Firefox.

I changed the code to reflect how you would use it with the recent
versions, making it easier for new developers to learn this
functionality.
@github-actions
Copy link

It looks like this is your first pull request. 🎉 Thank you for your contribution! One of the project maintainers will triage and assign the pull request for review. We appreciate your patience. To safeguard the health of the project, please take a moment to read our code of conduct.

Copy link
Collaborator

@rebloor rebloor left a comment

Choose a reason for hiding this comment

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

Loaded revised extension. Ran and noted it behaved as documented. Check code changes, all looked OK.

@rebloor rebloor merged commit 9433f84 into mdn:main Apr 21, 2023
@github-actions
Copy link

Congratulations on your first merged pull request. 🎉 Thank you for your contribution! Did you know we have a project board with high-impact contribution opportunities? We look forward to your next contribution.

@rebloor
Copy link
Collaborator

rebloor commented Apr 21, 2023

Many thanks for spotting and fixing that @Pedro-Celeste

@aug-dev
Copy link
Contributor Author

aug-dev commented Apr 21, 2023

@rebloor No problem! :)

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