New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@springernature/global-popup

Package Overview
Dependencies
Maintainers
13
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@springernature/global-popup - npm Package Compare versions

Comparing version 4.2.0 to 4.3.0

22

__tests__/popup.spec.js

@@ -24,2 +24,24 @@ import {Popup} from '../js/popup';

it('should open the popup when the trigger is clicked', () => {
const popup = new Popup(trigger, 'popupContent1');
const spy = jest.spyOn(popup._expander, 'open');
expect(spy).not.toHaveBeenCalled();
trigger.click();
expect(spy).toHaveBeenCalled();
});
it('should open the popup when the open method id called', () => {
const popup = new Popup(trigger, 'popupContent1');
const spy = jest.spyOn(popup._expander, 'open');
expect(spy).not.toHaveBeenCalled();
popup.open();
expect(spy).toHaveBeenCalled();
});
it('should build a popup that includes the arrow and close button html', () => {

@@ -26,0 +48,0 @@ new Popup(trigger, 'popupContent1');

3

HISTORY.md
# History
## 4.3.0 (2021-03-03)
* Adds an open method to allow lazily creating a popup when the trigger is clicked
## 4.2.0 (2021-02-17)

@@ -4,0 +7,0 @@ * Fixes bug so that popup/arrow is positioned above trigger

@@ -24,2 +24,6 @@ import {Expander} from '@springernature/global-expander/js/expander';

open() {
this._expander.open();
}
_build() {

@@ -26,0 +30,0 @@ this._content.insertAdjacentHTML('beforeend', this._closeButton + this._arrow);

4

package.json
{
"name": "@springernature/global-popup",
"version": "4.2.0",
"version": "4.3.0",
"description": "Builds and styles a popup that can be opened and closed",

@@ -12,4 +12,4 @@ "license": "MIT",

"scripts": {
"postinstall": "npm_config_registry=https://registry.npmjs.org/ npx @springernature/util-context-warning@0.0.5 -p @springernature/global-popup@4.2.0 -v 9.0.1 9.0.2 9.0.3 9.0.4 9.0.5 9.0.6 9.1.0 9.1.1"
"postinstall": "npm_config_registry=https://registry.npmjs.org/ npx @springernature/util-context-warning@0.0.5 -p @springernature/global-popup@4.3.0 -v 9.0.1 9.0.2 9.0.3 9.0.4 9.0.5 9.0.6 9.1.0 9.1.1"
}
}

@@ -59,1 +59,25 @@ # Global Popup

```
### Lazily
If you wish to lazily create a popup the first time the trigger is clicked - for example if building the html for your popup is an expensive operation that you'd like to defer until needed - you can use this pattern:
```javascript
import {Popup} from 'global-popup/js/popup';
const trigger = document.querySelector('span');
trigger.addEventListener('click', function() {
const popup = new Popup(trigger, 'popupContent1');
popup.open();
}, {capture: false, once: true});
```
```html
<div>
<span>Popup trigger</span>
<div id="popupContent1">
<p>Some popup text</p>
</div>
</div>
```
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc