Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@juggle/resize-observer

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@juggle/resize-observer

Polyfills the ResizeObserver API and supports box size options from the latest spec

  • 3.4.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.8M
increased by11.56%
Maintainers
1
Weekly downloads
 
Created

What is @juggle/resize-observer?

The @juggle/resize-observer package is a polyfill for the ResizeObserver API, which allows developers to observe changes to the size of DOM elements and react accordingly. It provides a way to receive notifications when an element's content rectangle has changed its size, which is useful for responsive designs and element-specific layout updates.

What are @juggle/resize-observer's main functionalities?

Observing size changes in elements

This feature allows you to create a new ResizeObserver instance and observe size changes in DOM elements. When a change is detected, the callback function is executed with the new size information.

const resizeObserver = new ResizeObserver(entries => {
  for (let entry of entries) {
    console.log('Size changed:', entry.contentRect);
  }
});

resizeObserver.observe(document.querySelector('.resizable-element'));

Unobserving elements

This feature allows you to stop observing size changes in a DOM element that was previously being observed by the ResizeObserver instance.

resizeObserver.unobserve(document.querySelector('.resizable-element'));

Disconnecting the observer

This feature allows you to completely disconnect the ResizeObserver instance, which stops observing all elements and clears its references, allowing for garbage collection.

resizeObserver.disconnect();

Other packages similar to @juggle/resize-observer

Keywords

FAQs

Package last updated on 18 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

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