action(for:)
Retrieves the extension action for a given tab, or the default action if nil is passed.
Declaration
func action(for tab: (any WKWebExtensionTab)?) -> WKWebExtension.Action?Parameters
- tab:
The tab for which to retrieve the extension action, or
nilto get the default action.
Discussion
The returned object represents the action specific to the tab when provided; otherwise, it returns the default action. The default action is useful when the context is unrelated to a specific tab. When possible, specify the tab to get the most context-relevant action.