@juggle/resize-observer
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -8,3 +8,4 @@ import { ResizeObserverCallback } from './ResizeObserverCallback'; | ||
disconnect(): void; | ||
static toString(): string; | ||
} | ||
export { ResizeObserver }; |
@@ -20,3 +20,6 @@ import { ResizeObserverController } from './ResizeObserverController'; | ||
} | ||
static toString() { | ||
return 'function ResizeObserver () { [polyfill code] }'; | ||
} | ||
} | ||
export { ResizeObserver }; |
@@ -6,2 +6,3 @@ import { ResizeObserver } from './ResizeObserver'; | ||
declare const resizeObservers: ResizeObserverDetail[]; | ||
declare const process: () => boolean; | ||
export default class ResizeObserverController { | ||
@@ -13,2 +14,2 @@ static connect(resizeObserver: ResizeObserver, callback: ResizeObserverCallback): void; | ||
} | ||
export { ResizeObserverController, resizeObservers }; | ||
export { ResizeObserverController, resizeObservers, process }; |
@@ -0,4 +1,4 @@ | ||
import { schedule } from './utils/scheduler'; | ||
import { ResizeObservation } from './ResizeObservation'; | ||
import { ResizeObserverDetail } from './ResizeObserverDetail'; | ||
import { DOMInteractions } from './DOMInteractions'; | ||
import { hasActiveObservations } from './algorithms/hasActiveObservations'; | ||
@@ -31,17 +31,2 @@ import { hasSkippedObservations } from './algorithms/hasSkippedObservations'; | ||
}; | ||
let frameId; | ||
let extraFrames = 0; | ||
const notify = () => { | ||
cancelAnimationFrame(frameId); | ||
frameId = requestAnimationFrame(() => { | ||
if (process()) { | ||
extraFrames = 0; | ||
notify(); | ||
} | ||
else if (extraFrames < 60) { | ||
extraFrames += 1; | ||
notify(); | ||
} | ||
}); | ||
}; | ||
export default class ResizeObserverController { | ||
@@ -58,3 +43,3 @@ static connect(resizeObserver, callback) { | ||
detail.observationTargets.push(new ResizeObservation(target, options && options.box)); | ||
notify(); | ||
schedule(); | ||
} | ||
@@ -80,3 +65,2 @@ } | ||
} | ||
DOMInteractions.watch(notify); | ||
export { ResizeObserverController, resizeObservers }; | ||
export { ResizeObserverController, resizeObservers, process }; |
{ | ||
"name": "@juggle/resize-observer", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "ResizeObserver - Based on the official draft specification", | ||
@@ -5,0 +5,0 @@ "main": "./lib/ResizeObserver.js", |
@@ -125,3 +125,3 @@ # Resize Observer Polyfill | ||
- Building responsive applications. | ||
- Creating 'self-aware' Web Components. | ||
- Creating self-aware, responsive Web Components. | ||
- Making 3rd party libraries more responsive. e.g. charts and grids. | ||
@@ -128,0 +128,0 @@ - Locking scroll position to the bottom of elements - useful for chat windows and logs. |
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
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
36803
475