Panorama:TabGroupsAPI
From MozillaWiki
The purpose of this TabGroups API is to provide a simple storage for Panorama and its tab groups. Other add-ons which would like to access tab groups' data can use this API to do that.
Contents
Schema
Compatibility
We are planning to make it compatible with Firefox 12 (not confirmed yet)
Example
An example of tab groups' data stored in session storage for Panorama:
{windows: [{ tabs: [ {entries: [{url: "http://example.com/#1"}], extData: {"tabgroups": "{\"group\": \"group1-id\"}"}}, {entries: [{url: "http://example.com/#2"}], extData: {"tabgroups": "{\"group\": \"group2-id\"}"}} ], extData: { "tabgroups": "{\"group1-id\": {\"id\": \"group1-id\"}}, \"group2-id\": {\"id\": \"group2-id\"}}}" } }]}
Applications
Panorama
Panorama uses this TabGroups API to access the session storage for storing and retrieving tab groups' data.
Vertical Tabs
Tree Style Tabs
API Description
To use the TabGroups API, you first need to import the code module into your JavaScript scope:
Components.utils.import("resource:///modules/TabGroups.jsm");
Then you can obtain reference to it by simply accessing them from the TabGroups object exported by the code module. For example:
let allGroups = TabGroups.getGroups();
Provided objects, methods and events
TabGroups [Methods] TabGroup createGroup(DOMWindow aWindow) TabGroup[] getGroups() TabGroup[] getGroupsByWindow(DOMWindow aWindow) [Events] tabgroup-added tabgroup-removed window-closing TabGroup [Properties] id: string title: string tabs: xulTab[] [Methods] void addTab(xulTab aTab) void removeTab(xulTab aTab) void close() [Events] rename tab-added tab-removed close