Class WindowClient
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The WindowClient interface of the ServiceWorker API represents the scope of a service worker client that is a document in a browsing context, controlled by an active worker. The service worker client independently selects and uses a service worker for its own loading and sub-resources.
[Value("WindowClient")]
public class WindowClient : Client
- Inheritance
-
WindowClient
- Inherited Members
Remarks
Constructors
WindowClient()
public WindowClient()
Properties
AncestorOrigins
NOTE
ExperimentalancestorOrigins read-only property of the WindowClient interface is an array of strings listing the origins of all ancestors of the browsing context represented by this WindowClient in reverse order.
[Value("ancestorOrigins")]
public string[] AncestorOrigins { get; }
Property Value
- string[]
An array of strings.
Remarks
The first element in the array is the origin of this window's parent, and the last element is the origin of the top-level browsing context. If this window is itself a top-level browsing context, then ancestorOrigins is an empty array.
Focused
The focused read-only property of the
WindowClient interface is a boolean value that indicates whether
the current client has focus.
[Value("focused")]
public bool Focused { get; }
Property Value
- bool
A boolean value.
Remarks
VisibilityState
The visibilityState read-only property of the
WindowClient interface indicates the visibility of the current client.
This value can be one of "hidden", "visible", or"prerender".
[Value("visibilityState")]
public DocumentVisibilityState VisibilityState { get; }
Property Value
- DocumentVisibilityState
A string (See VisibilityState for values).
Remarks
Methods
Focus()
The focus() method of the WindowClient
interface gives user input focus to the current client and returns a
Promise that resolves to the existing
WindowClient.
[Value("focus")]
public Task<WindowClient> Focus()
Returns
- Task<WindowClient>
A {{jsxref("Promise")}} that resolves to the existing WindowClient.
Remarks
Navigate(string)
The navigate() method of the WindowClient
interface loads a specified URL into a controlled client page then returns a
{{jsxref("Promise")}} that resolves to the existing WindowClient.
[Value("navigate")]
public Task<WindowClient?> Navigate(string url)
Parameters
urlstring
Returns
- Task<WindowClient>
A {{jsxref("Promise")}} that resolves to the existing WindowClient if the URL is from the same origin as the service worker, or {{jsxref("Operators/null", "null")}} otherwise.