Table of Contents

Class CloseWatcher

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll
NOTE
Experimental
The CloseWatcher interface allows a custom UI component with open and close semantics to respond to device-specific close actions in the same way as a built-in component.
[Value("CloseWatcher")]
public class CloseWatcher : EventTarget
Inheritance
CloseWatcher
Inherited Members

Remarks

The CloseWatcher interface inherits from EventTarget.

-Close(string) event on HTMLDialogElement

See also on MDN

Constructors

CloseWatcher()

public CloseWatcher()

CloseWatcher(CloseWatcherOptions)

NOTE
Experimental
The CloseWatcher() constructor creates a new CloseWatcher object.
public CloseWatcher(CloseWatcherOptions options = null)

Parameters

options CloseWatcherOptions

Remarks

You can create CloseWatcher instances without user activation, and this can be useful to implement cases like session inactivity timeout dialogs. However, if you create more than one CloseWatcher without user activation, then the newly-created one will be grouped together with the last one, so a single close request will close them both. This means that it is important to call Destroy(), Close(), and RequestClose() properly.

See also on MDN

Properties

Oncancel

[Value("oncancel")]
public EventHandlerNonNull Oncancel { get; set; }

Property Value

EventHandlerNonNull

Onclose

[Value("onclose")]
public EventHandlerNonNull Onclose { get; set; }

Property Value

EventHandlerNonNull

Methods

Close()

NOTE
Experimental
The close() method of the CloseWatcher interface lets you skip any logic in the cancel event handler and immediately fire the close event. It then deactivates the close watcher as if destroy() was called.
[Value("close")]
public GlobalObject.Undefined Close()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

Destroy()

NOTE
Experimental
The destroy() method of the CloseWatcher interface deactivates the close watcher. This is intended to be called if the relevant UI element is torn down in some other way than being closed.
[Value("destroy")]
public GlobalObject.Undefined Destroy()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

After being deactivated, this CloseWatcher will no longer receive cancel or close events, and it will be possible to create new independent CloseWatcher instances.

See also on MDN

RequestClose()

NOTE
Experimental
The requestClose() method of the CloseWatcher interface fires a cancel event and if that event is not canceled with PreventDefault(), proceeds to fire a close event, and then finally deactivates the close watcher as if destroy() was called.
[Value("requestClose")]
public GlobalObject.Undefined RequestClose()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks