CloseWatcher

open class CloseWatcher(options: CloseWatcherOptions = definedExternally) : EventTarget(source)

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.

MDN Reference

Constructors

Link copied to clipboard
constructor(options: CloseWatcherOptions = definedExternally)

Properties

Functions

Link copied to clipboard
fun close()

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.

Link copied to clipboard
fun destroy()

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.

Link copied to clipboard
open fun dispatchEvent(event: Event): Boolean
Link copied to clipboard

The requestClose() method of the CloseWatcher interface fires a cancel event and if that event is not canceled with Event.preventDefault(), proceeds to fire a close event, and then finally deactivates the close watcher as if destroy() was called.

Link copied to clipboard