Skip to main content

TabGroupsPort

TabGroupsPort provides a unified, Promise-based interface for querying and managing the browser's tab grouping system.

Context

  • Availability: Background
  • Source: packages/ports/src/background/tab-groups/tab-groups.port.ts

Key Methods

  • query(queryInfo: TabGroupQueryInfo): Promise<WebExtTabGroup[]> - Filter and list tab groups.
  • get(groupId: number): Promise<WebExtTabGroup> - Retrieve a single tab group by ID.
  • update(groupId: number, updateProperties: Partial<WebExtTabGroup>): Promise<WebExtTabGroup> - Modify a group's title, color, or collapsed state.
  • move(groupId: number, index: number): Promise<WebExtTabGroup> - Reposition a group within its window.

Usage

import { TabGroupsPort } from '@hexajs-dev/ports';
import { Injectable, HexaContext } from '@hexajs-dev/common';

@Injectable({ context: HexaContext.Background })
export class TabOrganizerService {
constructor(private readonly tabGroups: TabGroupsPort) {}

async collapseAll() {
const groups = await this.tabGroups.query({});
for (const group of groups) {
await this.tabGroups.update(group.id, { collapsed: true });
}
}
}

API Reference Appendix

Below is the exhaustive, auto-generated technical reference for all types, interfaces, and signatures associated with this API.

Classes

TabGroupsPort

import { TabGroupsPort } from '@hexajs-dev/ports';
class TabGroupsPort { ... }

Methods

get()

get(groupId: number): Promise<HexaWebTabGroup>

query()

query(queryInfo: HexaWebTabGroupQueryInfo): Promise<HexaWebTabGroup[]>

update()

update(groupId: number, updateProperties: Partial<HexaWebTabGroup>): Promise<HexaWebTabGroup>