Closed Bug 1463892 Opened 7 years ago Closed 7 years ago

Improve example for tabs.get()

Categories

(Developer Documentation Graveyard :: Add-ons, enhancement, P1)

All
Other
enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: 5i13ghzt462u, Assigned: wbamberg)

References

()

Details

:: Developer Documentation Request Request Type: Correction Gecko Version: unspecified Technical Contact: :: Details The example at the bottom of the page, first get's the tabs.Tab object of the current tab. So far, so good. It then passes it to "getInfoForTab", which itself just sues the tab ID and passes it to browser.tabs.get() in order to get information about the current tab again. The problem: browser.tabs.get() also just returns a tabs.Tab object. So actually, it does not return a different object. Thus, the example just queries the object two times, before it does something with it. I think this is… to put it in this way… bad coding style or, shoudl I say, just useless? At least such an example should nopt be in the official docs, IMHO.
Priority: -- → P2
Summary: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/get → Improve example for tabs.get()
Assignee: nobody → wbamberg
Priority: P2 → P1
I've updated this example to fetch a tab on tabs.onActivated, which just passes in a tab ID. Does this look better to you?
Flags: needinfo?(c4609174)
Yeah, I'd say it is fine. :)
Flags: needinfo?(c4609174)
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.