@juggle/resize-observer
Advanced tools
Comparing version 0.1.2 to 0.2.0
@@ -9,4 +9,4 @@ export default class DOMRectReadOnly { | ||
this.left = this.x; | ||
this.bottom = this.height - this.top; | ||
this.right = this.width - this.left; | ||
this.bottom = this.top + this.height; | ||
this.right = this.left + this.width; | ||
return Object.freeze(this); | ||
@@ -13,0 +13,0 @@ } |
export default class ResizeObservation { | ||
target: Element; | ||
broadcastWidth: number; | ||
broadcastHeight: number; | ||
broadcastWidth: number | undefined; | ||
broadcastHeight: number | undefined; | ||
constructor(target: Element); | ||
isActive(): boolean; | ||
} |
import ResizeObserverEntry from './ResizeObserverEntry'; | ||
export default class ResizeObservation { | ||
constructor(target) { | ||
this.broadcastWidth = 0.0; | ||
this.broadcastHeight = 0.0; | ||
this.target = target; | ||
@@ -7,0 +5,0 @@ } |
@@ -5,3 +5,3 @@ import DOMRectReadOnly from './DOMRectReadOnly'; | ||
const getRect = (target) => { | ||
if ('SVGGraphicsElement' in window && target instanceof SVGGraphicsElement) { | ||
if ('SVGGraphicsElement' in window && target instanceof SVGGraphicsElement && 'getBBox' in target) { | ||
const box = target.getBBox(); | ||
@@ -8,0 +8,0 @@ return new DOMRectReadOnly(0, 0, box.width, box.height); |
{ | ||
"name": "@juggle/resize-observer", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "ResizeObserver - Based on the official draft specification", | ||
@@ -11,3 +11,6 @@ "main": "./lib/ResizeObserver.js", | ||
"scripts": { | ||
"test": "jest --coverage" | ||
"build": "tsc", | ||
"ci-tests": "npm test -- --ci --runInBand && cat coverage/lcov.info | coveralls", | ||
"test": "jest --coverage", | ||
"prepublishOnly": "npm run build" | ||
}, | ||
@@ -47,4 +50,6 @@ "repository": { | ||
"@types/jest": "^23.3.12", | ||
"coveralls": "^3.0.2", | ||
"jest": "^23.6.0", | ||
"jest-cli": "^23.6.0", | ||
"jest-junit": "^6.0.1", | ||
"jsdom": "^13.1.0", | ||
@@ -51,0 +56,0 @@ "sinon": "^7.2.2", |
# ResizeObserver | ||
[![CircleCI](https://circleci.com/gh/juggle/resize-observer.svg?style=svg)](https://circleci.com/gh/juggle/resize-observer) | ||
[![Coverage Status](https://coveralls.io/repos/github/juggle/resize-observer/badge.svg?branch=master)](https://coveralls.io/github/juggle/resize-observer?branch=master) | ||
A polyfill entirely based on the current **ResizeObserver** [Draft Specification](https://wicg.github.io/ResizeObserver). | ||
@@ -4,0 +7,0 @@ |
@@ -24,4 +24,4 @@ interface Rectangle { | ||
this.left = this.x; | ||
this.bottom = this.height - this.top; | ||
this.right = this.width - this.left; | ||
this.bottom = this.top + this.height; | ||
this.right = this.left + this.width; | ||
return Object.freeze(this); | ||
@@ -28,0 +28,0 @@ } |
@@ -6,4 +6,4 @@ import ResizeObserverEntry from './ResizeObserverEntry'; | ||
public target: Element; | ||
public broadcastWidth: number = 0.0; | ||
public broadcastHeight: number = 0.0; | ||
public broadcastWidth: number | undefined; | ||
public broadcastHeight: number | undefined; | ||
@@ -10,0 +10,0 @@ constructor (target: Element) { |
@@ -7,3 +7,3 @@ import DOMRectReadOnly from './DOMRectReadOnly'; | ||
const getRect = (target: Element) => { | ||
if ('SVGGraphicsElement' in window && target instanceof SVGGraphicsElement) { | ||
if ('SVGGraphicsElement' in window && target instanceof SVGGraphicsElement && 'getBBox' in target) { | ||
const box = target.getBBox(); | ||
@@ -10,0 +10,0 @@ return new DOMRectReadOnly(0, 0, box.width, box.height); |
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
20606
52
9
473