Skip to content

Commit e1e68ff

Browse files
committed
docs
1 parent 818646d commit e1e68ff

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

special-pages/pages/new-tab/app/new-tab.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ children:
1111
- ./customizer/customizer.md
1212
- ./protections/protections.md
1313
- ./omnibar/omnibar.md
14+
- ./tabs/tabs.md
1415
---
1516

1617
## Requests
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Tabs
3+
---
4+
5+
# Tabs
6+
7+
This feature allows native sides to indicate which 'tab' is currently active.
8+
9+
The fields `tabId` and `tabIds` are used together to indicate which tabs are open and which is active.
10+
11+
For example, the following indicates that there are three tabs and `def` is the visible one.
12+
13+
```json
14+
{
15+
"tabId": "def",
16+
"tabIds": ["abc", "def", "ghi"]
17+
}
18+
```
19+
20+
To remove a tab you would send a shorter list. To add a tab, send a longer list. To switch between tabs, send the
21+
entire list still, but update `tabId` to reflect the currently active tab.
22+
23+
**NOTE: you MUST send both fields every time.**
24+
25+
## Setup
26+
27+
Since this data is global in nature, you must add the initial tab state to {@link "NewTab Messages".InitialSetupResponse}
28+
29+
- Add {@link "NewTab Messages".Tabs} to the `tabs` field on {@link "NewTab Messages".InitialSetupResponse}
30+
- Example:
31+
32+
```json
33+
{
34+
"...": "...",
35+
"tabs": {
36+
"tabId": "abc",
37+
"tabIds": ["abc", "def"]
38+
}
39+
}
40+
```
41+
42+
## Subscriptions:
43+
44+
Once the page is running, you can send `tabs_onDataUpdate` updates as often as you need to.
45+
46+
### `tabs_onDataUpdate`
47+
- {@link "NewTab Messages".TabsOnDataUpdateSubscription}.
48+
- Updates for tab information including active tab ID and list of available tab IDs.
49+
- returns {@link "NewTab Messages".Tabs}
50+
```json
51+
{
52+
"tabId": "string",
53+
"tabIds": ["string", "string"]
54+
}
55+
```

0 commit comments

Comments
 (0)