setSelected(_:for:completionHandler:)
Called to set the selected state of the tab.
Declaration
optional func setSelected(_ selected: Bool, for context: WKWebExtensionContext, completionHandler: @escaping ((any Error)?) -> Void)optional func setSelected(_ selected: Bool, for context: WKWebExtensionContext) async throwsParameters
- selected:
A boolean value indicating whether to select the tab.
- context:
The context in which the web extension is running.
- completionHandler:
A block that must be called upon completion. It takes a single error argument, which should be provided if any errors occurred.
Discussion
This is equivalent to the user command-clicking on the tab to add it to or remove it from a selection.
The method should update the tab’s selection state without changing the active tab. No action is performed if not implemented.