-
Notifications
You must be signed in to change notification settings - Fork 22.5k
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
Add devtools.panels.ExtensionSidebarPane.setHeight #32150
base: main
Are you sure you want to change the base?
Add devtools.panels.ExtensionSidebarPane.setHeight #32150
Conversation
Preview URLs
External URLs (1)URL:
(comment last updated: 2024-09-10 23:35:17) |
let setting = browser.devtools.panels.setHeight( | ||
height, // string | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setHeight()
method is exposed on the ExtensionSidebarPane
interface, not on the panels
namespace in devtools
. To my knowledge the only way to get a reference to an instance of this this interface is to create a pane using the createSidebarPane()
method on certain ExtensionPanel instances: elements
, network
, and sources
. Chrome supports all 3 of these, but Firefox only supports elements
.
Please adapt this code to the appropriate conventions.
let setting = browser.devtools.panels.setHeight( | |
height, // string | |
) | |
browser.devtools.panels.elements.createSidebarPane("My Pane", (pane) => { | |
pane.setPage("elements-pane.html"); | |
pane.setHeight("200px"); | |
}); |
|
||
Sets the height of the sidebar. | ||
|
||
This is an asynchronous function that returns a [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to mdn/browser-compat-data#22182 this method is only supported in Chrome. Chrome's implementation does return a promise or accept a callback. When called, it immediately returns undefined
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dotproto however, although this is an implemented in Firefox, currently the documentation is written from a Firefox perspective e.g. if this was implemented in Firefox, would it not be implemented as an asynchronous function that returns a promise?
|
||
{{Compat}} | ||
|
||
> **Note:** This API is based on Chromium's [`chrome.devtools.panels`](https://developer.chrome.com/docs/extensions/reference/devtools_panels/) API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[markdownlint] reported by reviewdog 🐶
search-replace Custom rule [gfm-alert: Use the GFM syntax: https://developer.mozilla.org/en-US/docs/MDN/Writing_guidelines/Howto/Markdown_in_MDN#notes_warnings_and_callouts] [Context: "column: 1 text:'> Note:'"]
Description
Documentation for devtools.panels.ExtensionSidebarPane.setHeight
Motivation
To complement the browser compatibility data added in mdn/browser-compat-data#22182