feat: Added devtools.panels.elements.createSidebarPane to metadata#247
feat: Added devtools.panels.elements.createSidebarPane to metadata#247rpl merged 2 commits intomozilla:masterfrom akhilpanchal:add-chrome-devtools-createSideBarPane-api
Conversation
api-metadata.json
Outdated
| "elements": { | ||
| "createSidebarPane": { | ||
| "minArgs": 1, | ||
| "maxArgs": 2 |
There was a problem hiding this comment.
It looks that "maxArgs" should be set to 1 for devtools.elements.createSidebarPane:
- if you look to the api docs for
devtools.panels.createin the chrome.devtools.panels doc page you can see that it does have 3 mandatory parameters + the optional callback - the api docs for
devtools.panels.elements.createSidebarPanein the same doc page shows that it does have 1 mandatory parameter (the sidebar title) + the optional callback
and so maxArgs should be set to the maximum number of parameters that the API method does expect without counting the optional callback.
The reason for that is that the corresponding promised-based API method signature shouldn't expect a callback parameter (and the polyfill will pass a callback internally to the wrapped chrome callback-based API method), e.g.:
chrome.devtools.panels.elements.createSidebarPane("my sidebar", (sidebarPanel) => ...);
translates into:
const sidebarPanel = await browser.devtools.panels.elements.createSidebarPane("my sidebar");
...
// or
devtools.panels.elements.createSidebarPane("my sidebar").then(sidebarPanel => ...);
There was a problem hiding this comment.
Thanks again for the explanation. That makes a lot of sense.
Could you also explain what the role of singleCallbackArg property is?
I looked at the following lines and I am a little unsure about when to use this property.
webextension-polyfill/src/browser-polyfill.js
Lines 95 to 100 in 8c7be46
|
Thanks so much, @akhilpanchal! Your contribution has been added to our recognition wiki. 🎉 Welcome onboard! We look forward to seeing you around. |
Fixes #246