Socket
Book a DemoInstallSign in
Socket

@automattic/popup-monitor

Package Overview
Dependencies
Maintainers
36
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@automattic/popup-monitor

Utility to facilitate the monitoring of a popup window close action.

latest
Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
1.6K
122.48%
Maintainers
36
Weekly downloads
 
Created
Source

Popup Monitor

Popup Monitor is a small utility to facilitate the monitoring of a popup window close action, which is especially useful for temporary popup windows (e.g. an authorization step).

Usage

A Popup Monitor instance offers an open function which accepts an identical set of arguments as the standard window.open browser offering. When the window is closed, a close event is emitted to the instance with the name of the closed window.

import PopupMonitor from '@automattic/popup-monitor';

const popupMonitor = new PopupMonitor();

popupMonitor.open( 'https://wordpress.com/', 'my-popup' );

popupMonitor.on( 'close', function ( name ) {
	if ( 'my-popup' === name ) {
		console.log( 'Window closed!' );
	}
} );

Methods

  • open( url, name, features ): Proxies an identical call to window.open and begins to monitor the window open state.
  • getScreenCenterSpecs( width, height ): A helper method for generating a feature (specification) string of a specific width and height at the center of the user's screen.

Keywords

wordpress

FAQs

Package last updated on 24 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts