Socket
Socket
Sign inDemoInstall

@automattic/popup-monitor

Package Overview
Dependencies
2
Maintainers
36
Versions
3
Alerts
File Explorer

Advanced tools

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.


Version published
Weekly downloads
318
decreased by-39.77%
Maintainers
36
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 24 Aug 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc