Closed
Bug 862601
Opened 12 years ago
Closed 7 years ago
tabs module should have a getTabById() method
Categories
(Add-on SDK Graveyard :: General, defect, P3)
Add-on SDK Graveyard
General
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: KWierso, Unassigned)
References
Details
(Whiteboard: [good next bug])
Attachments
(1 file)
355 bytes,
text/plain
|
Details |
When you have a tab's id value and you want to get that tab object, it'd be nice to not have to manually iterate through all open tabs, trying to match that id against each one.
It'd be nice if there was some convenience function called getTabById(id) or something like that as part of the high-level tabs module to do it for us.
Reporter | ||
Updated•12 years ago
|
Priority: -- → P3
Updated•12 years ago
|
Assignee: nobody → jgriffiths
Updated•12 years ago
|
Whiteboard: [good first bug]
Comment 1•12 years ago
|
||
Pointer to Github pull-request
Comment 2•12 years ago
|
||
The PR currently is WIP, need to test on Fennec.
Comment 4•12 years ago
|
||
not `getTabById` -> `getById`
Comment 5•12 years ago
|
||
or make the method an export from the tabs module separate from the tabs iterator.
Comment 6•12 years ago
|
||
(In reply to Erik Vold [:erikvold] [:ztatic] from comment #5)
> or make the method an export from the tabs module separate from the tabs
> iterator.
hmm I guess this isn't possible.. the iterator is the export object..
Comment 7•12 years ago
|
||
The method name was Wes' original proposal, I have no strong opinion on getTabyId vs getById.
Comment 8•12 years ago
|
||
I'm fine with both `getTabyId` / `getById`. Although since it's exposed by tabs module tabs.getTabById feels like unnecessary repetition.
This also got me thinking that it maybe better to just add:
`tabs.get(handle) // => Tab`
to continue the style established lately. For now we could just support
string `id`'s, but in a future we can extend this to support `tabs.get(tabNode)`.
Alternatively we could go with `tabs.from(handle)` to match closer ES.next Array.from
Flags: needinfo?(rFobic)
Comment 9•12 years ago
|
||
(In reply to Irakli Gozilalishvili [:irakli] [:gozala] [@gozala] from comment #8)
> I'm fine with both `getTabyId` / `getById`. Although since it's exposed by
> tabs module tabs.getTabById feels like unnecessary repetition.
>
> This also got me thinking that it maybe better to just add:
>
> `tabs.get(handle) // => Tab`
>
> to continue the style established lately. For now we could just support
> string `id`'s, but in a future we can extend this to support
> `tabs.get(tabNode)`.
+1 for `get`, good idea!
Comment 10•12 years ago
|
||
(In reply to Irakli Gozilalishvili [:irakli] [:gozala] [@gozala] from comment #8)
> Alternatively we could go with `tabs.from(handle)` to match closer ES.next
> Array.from
From my google searches it seems like Array.from converts array like things to a real array.
Updated•12 years ago
|
Assignee: jgriffiths → nobody
Comment 12•10 years ago
|
||
Someone could certainly write and publish a module that does this - I think it makes more sense for it to be in the tabs module but I also see that people aren't screaming for it.
Flags: needinfo?(jgriffiths)
Updated•10 years ago
|
Whiteboard: [good first bug] → [good next bug]
Comment 13•7 years ago
|
||
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•