Socket
Socket
Sign inDemoInstall

@juggle/resize-observer

Package Overview
Dependencies
0
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.1 to 0.4.2

2

package.json
{
"name": "@juggle/resize-observer",
"version": "0.4.1",
"version": "0.4.2",
"description": "ResizeObserver - Based on the official draft specification",

@@ -5,0 +5,0 @@ "main": "./lib/ResizeObserver.js",

@@ -8,5 +8,7 @@ # ResizeObserver

A polyfill entirely based on the current **ResizeObserver** [Draft Specification](https://wicg.github.io/ResizeObserver).
A polyfill/ponyfill entirely based on the current **ResizeObserver** [Draft Specification](https://wicg.github.io/ResizeObserver).
This library observes elements and dispatches notifications when dimensions change. No polling of the DOM is required, except for when animations or transitions are active, keeping CPU and power consumption minimal.
## Installation

@@ -21,7 +23,10 @@ ``` shell

const resizeObserver = new ResizeObserver((entries, observer) => {
console.log('Something has resized!');
const ro = new ResizeObserver((entries, observer) => {
console.log('Body has resized!');
observer.disconnect(); // Stop observing
});
ro.observe(document.body); // Watch dimension changes on body
```
This will always use the polyfilled version of **ResizeObserver**, even if the browser supports **ResizeObserver** natively.
This will use the ponyfilled version of **ResizeObserver**, even if the browser supports **ResizeObserver** natively.

@@ -38,3 +43,4 @@

const resizeObserver = new ResizeObserver((entries, observer) => {
// Uses native or polyfill, depending on browser support
const ro = new ResizeObserver((entries, observer) => {
console.log('Something has resized!');

@@ -41,0 +47,0 @@ });

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