Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
size-sensor
Advanced tools
Readme
DOM element size sensor which will callback when the element size changed.
DOM 元素尺寸监听器,当元素尺寸变化的时候,将会触发回调函数!
npm i --save size-sensor
Then import it.
import { bind, clear } from 'size-sensor';
or import it by script
in HTML, then get sizeSensor
on window.
<script src="https://unpkg.com/size-sensor/dist/size-sensor.min.js"></script>
import { bind, clear } from 'size-sensor';
// bind the event on element, will get the `unbind` function
const unbind1 = bind(document.querySelector('.container'), element => {
// do what you want to to.
});
const unbind2 = bind(document.querySelector('.container'), element => {
// do what you want to to.
});
// if you want to cancel bind event.
unbind1();
import { bind, clear } from 'size-sensor';
/*
* // bind the resize event.
* const unbind1 = bind(...);
* const unbind2 = bind(...);
* ...
*/
// you can cancel all the event of element.
clear(element);
There is only 2 API:
Bind the resize trigger function on element. The function will return unbind
function.
Clear all the object and resize event on element.
The size sensor strategies include:
ResizeObserver
: use resizeObserver to observe element's size.object
: use object document's resize event.If ResizeObserver
exists, use it, else use object
as default.
Online demo click here. Used By:
ISC@hustcc.
FAQs
DOM element size sensor which will callback when size changed.
The npm package size-sensor receives a total of 334,470 weekly downloads. As such, size-sensor popularity was classified as popular.
We found that size-sensor demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.