spolu / breach_core

A Browser written in JS. Free. Modular. Hackable.
https://breach.github.io/breach_core/
MIT License
5.39k stars 411 forks source link

Get the current foreground tab #188

Open nearsyh opened 10 years ago

nearsyh commented 10 years ago

Is it possible to get the current foreground tab id?

nearsyh commented 10 years ago

Seems impossible with the apI of the current version.

kyleshrader commented 10 years ago

Line 131 of https://github.com/breach/breach_core/blob/master/lib/core_tabs.js Also I think the tabs_state has this information (shrug)

spolu commented 10 years ago

You can use tabs_get and look for the visible key for each tab

nearsyh commented 10 years ago

@kylekinkade the visibile_tab is private which I think is not good to use.

spolu commented 10 years ago

@nearsyh @kylekinkade it's definitely not accessible from other moduiles... that's why you want tabs_get from modules

nearsyh commented 10 years ago

@spolu Thanks! But maybe adding an api for this is a good idea.

spolu commented 10 years ago

@nearsyh You mean have direct access to the visible tab?

nearsyh commented 10 years ago

Yes.

brayniverse commented 10 years ago

@spolu If you would like I can make a PR for a tabs_current method that traverses the array provided by tabs_get and returns the current tab? Unless you have other plans.

spolu commented 10 years ago

Sure that could be useful!