Gathering detailed insights and metrics for resize-detector
Gathering detailed insights and metrics for resize-detector
Gathering detailed insights and metrics for resize-detector
Gathering detailed insights and metrics for resize-detector
npm install resize-detector
Typescript
Module System
Node Version
NPM Version
99.6
Supply Chain
99
Quality
75.9
Maintenance
100
Vulnerability
100
License
JavaScript (94.84%)
CSS (5.16%)
Total Downloads
17,737,250
Last Day
2,537
Last Week
74,631
Last Month
310,839
Last Year
4,640,180
NOASSERTION License
156 Stars
32 Commits
21 Forks
7 Watchers
11 Branches
5 Contributors
Updated on Jan 15, 2025
Minified
Minified + Gzipped
Latest Version
0.3.0
Package Id
resize-detector@0.3.0
Size
7.77 kB
NPM Version
6.14.11
Node Version
12.13.1
Published on
Feb 20, 2021
Cumulative downloads
Total Downloads
Last Day
-7.8%
2,537
Compared to previous day
Last Week
-4.7%
74,631
Compared to previous week
Last Month
-8.5%
310,839
Compared to previous month
Last Year
18.8%
4,640,180
Compared to previous year
This project is basically a modified version of sdecima/javascript-detect-element-resize including these changes:
ResizeObserver
first..css
file.1$ npm i --save resize-detector
1import { addListener, removeListener } from 'resize-detector' 2 3// adding listener 4addListener(elem, callback) 5 6// removing listener, callback can be omitted to indicate that 7// all event listeners should be removed 8removeListener(elem, callback)
this
inside callback
function is the element whose size has been changed, also callback
receive element as first argument.
As resize-detector
is published in both ES Module & CommonJS format and when you use webpack to bundle your app, the ESM version will be imported. It is not transpiled by Babel or similar tools so you have to transpile it in your build process.
For webpack with babe-loader you need to add it to the include
field of the options:
1// ... 2{ 3 test: /\.js$/, 4 loader: 'babel-loader', 5 include: [ 6 // other stuff to be transpiled 7 // ... 8 path.resolve('node_modules/resize-detector') 9 ] 10} 11// ...
If you are using other toolchain, just configure your bundler similarly so that resize-detector
will be transpiled during build process.
Is polyfill?
No.
Native first
Yes.
Strategy
Scroll-based + Mutation-based.
Pros
Side effects
position: static
will become position: relative
.Is polyfill?
No.
Native first
No.
Strategy
Scroll-based.
Pros
<object>
s.Side effects
position: static
will become position: relative
.Limitations
Is polyfill
Yes.
Native first
Yes.
Fallback Strategy
Use MutationObserver
to observe every mutation in a document. For IE9/10, use Mutation Events instead.
Pros
Limitations
:hover
.Is polyfill
No.
Native first
No.
Strategy
Listen to resize
events via hidden <iframe>
s.
Pros
Dead simple.
Side effects
position: static
will become position: relative
.Limitations
Is polyfill?
Yes.
Native first
Yes.
Fallback Strategy
Long polling through requestAnimationFrame
or setTimeout
.
Pros
Dead simple.
Side effects
Is polyfill?
No.
Native first
No.
Strategy
Either hidden <object>
s or scroll-based.
Pros
Two approaches available (Really, why?) with scroll-based approach being much faster than hidden <object>
s.
Side effects
position: static
will become position: relative
.Limitations
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 4/28 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
28 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More