@juggle/resize-observer
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "@juggle/resize-observer", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Polyfills the ResizeObserver API and supports box size options from the latest spec", | ||
@@ -5,0 +5,0 @@ "main": "./lib/ResizeObserver.js", |
@@ -12,4 +12,3 @@ # Resize Observer Polyfill | ||
> **Warning:**<br/> | ||
> The latest Resize Observer specification is not yet finalised and is subject to change. | ||
> The latest [Resize Observer specification](https://drafts.csswg.org/resize-observer-1/) is not yet finalised and is subject to change. | ||
> Any drastic changes to the specification will bump the major version of this library, as there will likely be breaking changes. | ||
@@ -94,3 +93,2 @@ | ||
> **Warning:**<br/> | ||
> This is a **deprecated** feature and will possibly be removed in later versions. | ||
@@ -108,3 +106,3 @@ | ||
// Uses native or polyfill, depending on browser support | ||
// Uses native or polyfill, depending on browser support. | ||
const ro = new ResizeObserver((entries, observer) => { | ||
@@ -115,3 +113,18 @@ console.log('Something has resized!'); | ||
> **Warning:**<br/> | ||
To improve this even more, you could use dynamic imports to only load the file when the polyfill is required. | ||
``` js | ||
(async () => { | ||
if ('ResizeObserver' in window === false) { | ||
// Loads polyfill asynchronously, only if required. | ||
const module = await import('@juggle/resize-observer'); | ||
window.ResizeObserver = module.ResizeObserver; | ||
} | ||
// Uses native or polyfill, depending on browser support. | ||
const ro = new ResizeObserver((entries, observer) => { | ||
console.log('Something has resized!'); | ||
}); | ||
})(); | ||
``` | ||
> Browsers with native support may be behind on the latest specification. | ||
@@ -125,3 +138,3 @@ > Use `entry.contentRect` when switching between native and polyfilled versions. | ||
If an element's observed box size changes again within the same resize loop, the observation will be skipped and an error event will be dispatched on the window. | ||
If an element's observed box size changes again within the same resize loop, the observation will be skipped and an error event will be dispatched on the window. Elements with undelivered notifications will be considered for delivery in the next loop. | ||
@@ -184,6 +197,6 @@ ```js | ||
- No support for **IE10** and below. **IE11** is supported, when bundled and transpiled into ES5. | ||
- Dynamic stylesheet changes may not be noticed.* | ||
- Transitions with initial delays cannot be detected.* | ||
- Animations and transitions with long periods of no change, will not be detected.* | ||
- No support for **IE10** and below. **IE11** is supported, when bundled and transpiled into ES5. Additional polyfills may also be required, depending on tooling used. | ||
@@ -190,0 +203,0 @@ \* If other interaction occurs, changes will be detected. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
216
21479
3
0
1
2