Skip to content

close-watcher

NPM version

Platform Support

Platform Support

Platform Support

Platform Support

Introduction:

Used for monitoring close requests Refer to WICG close-watcher

Usage

The CloseWatcher has been injected into the global environment, effectively implementing the standard in advance, so it can be used directly.

ts
const closeWatcher = new CloseWatcher();
closeWatcher.addEventListener("close", (event) => {
  closeWatcher.close();
});

CloseWatcher is consumable; each new instance will block a system back action.

On desktop, it counters the esc button