domain/tabs/tab-service
Classes
Section titled “Classes”TabService
Section titled “TabService”Defined in: app/src/domain/tabs/tab-service.ts:96
Owns the tabs of one window: their order, the active tab and recently closed tabs. A window always keeps at least one tab.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TabService(
views,blankUrl,onLastClosed?):TabService
Defined in: app/src/domain/tabs/tab-service.ts:117
Parameters
Section titled “Parameters”Creates and controls the web views.
blankUrl
Section titled “blankUrl”string
URL of a new, empty tab.
onLastClosed?
Section titled “onLastClosed?”() => void
Called instead of opening a new tab when the last tab closes.
Returns
Section titled “Returns”Properties
Section titled “Properties”onDidChange
Section titled “onDidChange”
readonlyonDidChange:Event<void>
Defined in: app/src/domain/tabs/tab-service.ts:110
Fires after any tab or the active tab changed.
Accessors
Section titled “Accessors”active
Section titled “active”Get Signature
Section titled “Get Signature”get active():
Tab|undefined
Defined in: app/src/domain/tabs/tab-service.ts:129
The active tab, if any.
Returns
Section titled “Returns”Tab | undefined
Get Signature
Section titled “Get Signature”get all(): readonly
Tab[]
Defined in: app/src/domain/tabs/tab-service.ts:124
All tabs in display order.
Returns
Section titled “Returns”readonly Tab[]
Methods
Section titled “Methods”activate()
Section titled “activate()”activate(
id):void
Defined in: app/src/domain/tabs/tab-service.ts:170
Makes a tab the active tab.
Parameters
Section titled “Parameters”string
The tab.
Returns
Section titled “Returns”void
close()
Section titled “close()”close(
id):void
Defined in: app/src/domain/tabs/tab-service.ts:185
Closes a tab. Closing the active tab activates its right neighbour, or the left one at the end. Closing the last tab opens a blank tab.
Parameters
Section titled “Parameters”string
The tab.
Returns
Section titled “Returns”void
dispose()
Section titled “dispose()”dispose():
void
Defined in: app/src/domain/tabs/tab-service.ts:263
Destroys every view and removes listeners.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”navigate()
Section titled “navigate()”navigate(
id,url):void
Defined in: app/src/domain/tabs/tab-service.ts:227
Loads a URL in a tab.
Parameters
Section titled “Parameters”string
The tab.
string
The URL.
Returns
Section titled “Returns”void
open()
Section titled “open()”open(
url?,options?):string
Defined in: app/src/domain/tabs/tab-service.ts:140
Opens a tab after the active one, or in the background after the tabs opened there before it, as Chromium does.
Parameters
Section titled “Parameters”string = ...
URL to load; defaults to the blank page.
options?
Section titled “options?”OpenTabOptions = {}
Whether to activate the tab.
Returns
Section titled “Returns”string
The new tab’s id.
reopenClosed()
Section titled “reopenClosed()”reopenClosed():
string|undefined
Defined in: app/src/domain/tabs/tab-service.ts:217
Reopens the most recently closed tab.
Returns
Section titled “Returns”string | undefined
The reopened tab’s id, or undefined if nothing was closed.
run(
id,action):void
Defined in: app/src/domain/tabs/tab-service.ts:237
Runs a history or loading action in a tab.
Parameters
Section titled “Parameters”string
The tab.
action
Section titled “action”"back" | "forward" | "reload" | "stop"
What to do.
Returns
Section titled “Returns”void
update()
Section titled “update()”update(
id,update):void
Defined in: app/src/domain/tabs/tab-service.ts:247
Applies state reported by the web view, such as a new title.
Parameters
Section titled “Parameters”string
The tab.
update
Section titled “update”Changed fields.
Returns
Section titled “Returns”void
Interfaces
Section titled “Interfaces”OpenTabOptions
Section titled “OpenTabOptions”Defined in: app/src/domain/tabs/tab-service.ts:61
Options for TabService.open.
Properties
Section titled “Properties”activate?
Section titled “activate?”
readonlyoptionalactivate?:boolean
Defined in: app/src/domain/tabs/tab-service.ts:67
Whether the new tab becomes the active tab. Defaults to true. Tabs opened in the
background line up after the active tab in the order they open, until another tab
becomes active, so links opened one after another keep their order.
readonlyoptionallazy?:boolean
Defined in: app/src/domain/tabs/tab-service.ts:69
Creates the tab’s view only when the tab is shown.
title?
Section titled “title?”
readonlyoptionaltitle?:string
Defined in: app/src/domain/tabs/tab-service.ts:71
Title to show until the page reports its own, such as the title of a restored tab.
Defined in: app/src/domain/tabs/tab-service.ts:22
The state of one tab.
Properties
Section titled “Properties”blocked
Section titled “blocked”
readonlyblocked:number
Defined in: app/src/domain/tabs/tab-service.ts:30
Requests that the content blocker blocked on the current page.
canGoBack
Section titled “canGoBack”
readonlycanGoBack:boolean
Defined in: app/src/domain/tabs/tab-service.ts:27
canGoForward
Section titled “canGoForward”
readonlycanGoForward:boolean
Defined in: app/src/domain/tabs/tab-service.ts:28
readonlyid:string
Defined in: app/src/domain/tabs/tab-service.ts:23
loading
Section titled “loading”
readonlyloading:boolean
Defined in: app/src/domain/tabs/tab-service.ts:26
problem
Section titled “problem”
readonlyproblem:TabProblem|null
Defined in: app/src/domain/tabs/tab-service.ts:32
Why the tab shows no page, or null when it shows one.
readonlytitle:string
Defined in: app/src/domain/tabs/tab-service.ts:25
readonlyurl:string
Defined in: app/src/domain/tabs/tab-service.ts:24
readonlyzoom:number
Defined in: app/src/domain/tabs/tab-service.ts:34
The zoom factor of the page, 1 for 100 %.
TabProblem
Section titled “TabProblem”Defined in: app/src/domain/tabs/tab-service.ts:14
Why a tab shows no page: the page could not be loaded (error), the certificate of its
site is not trusted (certificate), or the process that showed it is gone (crashed).
code is Chromium’s name for the cause, such as ERR_CONNECTION_REFUSED, url the
address of the page, and proceed whether the user may continue to it after a warning.
Properties
Section titled “Properties”
readonlycode:string
Defined in: app/src/domain/tabs/tab-service.ts:16
readonlykind:"error"|"certificate"|"crashed"
Defined in: app/src/domain/tabs/tab-service.ts:15
proceed
Section titled “proceed”
readonlyproceed:boolean
Defined in: app/src/domain/tabs/tab-service.ts:18
readonlyurl:string
Defined in: app/src/domain/tabs/tab-service.ts:17
TabViewPort
Section titled “TabViewPort”Defined in: app/src/domain/tabs/tab-service.ts:44
Port to the web views of a window. The platform layer implements it with one
WebContentsView per tab; tests use a fake.
Methods
Section titled “Methods”create()
Section titled “create()”create(
id,url,lazy?):void
Defined in: app/src/domain/tabs/tab-service.ts:49
Creates the view of a tab and loads the URL. A lazy tab gets its view only when it is shown, so restored tabs cost nothing until they are used.
Parameters
Section titled “Parameters”string
string
boolean
Returns
Section titled “Returns”void
destroy()
Section titled “destroy()”destroy(
id):void
Defined in: app/src/domain/tabs/tab-service.ts:53
Destroys the view of a tab.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
load()
Section titled “load()”load(
id,url):void
Defined in: app/src/domain/tabs/tab-service.ts:55
Loads a URL in a tab.
Parameters
Section titled “Parameters”string
string
Returns
Section titled “Returns”void
run(
id,action):void
Defined in: app/src/domain/tabs/tab-service.ts:57
Runs a history or loading action.
Parameters
Section titled “Parameters”string
action
Section titled “action”"back" | "forward" | "reload" | "stop"
Returns
Section titled “Returns”void
show()
Section titled “show()”show(
id):void
Defined in: app/src/domain/tabs/tab-service.ts:51
Shows the view of a tab and hides the previously shown one.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Type Aliases
Section titled “Type Aliases”TabId =
string
Defined in: app/src/domain/tabs/tab-service.ts:6
Identifier of a tab, such as t1a.
TabUpdate
Section titled “TabUpdate”TabUpdate =
Partial<Omit<Tab,"id">>
Defined in: app/src/domain/tabs/tab-service.ts:38
Fields of a tab that the web view reports.
Variables
Section titled “Variables”TabServiceToken
Section titled “TabServiceToken”
constTabServiceToken:Token<TabService>
Defined in: app/src/domain/tabs/tab-service.ts:75
Token for the TabService of a window.