File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed
special-pages/pages/new-tab/app Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ children:
11
11
- ./customizer/customizer.md
12
12
- ./protections/protections.md
13
13
- ./omnibar/omnibar.md
14
+ - ./tabs/tabs.md
14
15
---
15
16
16
17
## Requests
Original file line number Diff line number Diff line change
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
+ ```
You can’t perform that action at this time.
0 commit comments