Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-delayload
Advanced tools
A library offering delay-loading of images for React, same as Lazyload for jQuery. Moreover, offering a compatible function using plain javascript for manipulating HTML content directly.
Like Lazyload plugin for jQuery, Delayload is library offering a React component for delay-loading images, and it uses throttle to lower the render cost when scrolling and resizing. Moreover, for raw HTML contents created by HTML editors, the library also offers a function for DOM manipulation using plain javascript, and there is no need to require jQuery.
npm install react-delayload --save-dev
####React Component
import DelayLoad from 'react-delayload'
render() {
return (
<div>
{
this.props.images.map(function(image, idx) {
return (
<DelayLoad key={idx}>
<img src={image}/>
</DelayLoad>
)
})
}
</div>
)
}
Attributes
enableDelay
: Whether to enable delay-loading. Default as trueheight
: Height of placeholder block. Default as 0threshold
: Setting threshold causes image to load N pixels before it appears on viewport. Default as 0Full example ./example/test.jsx
####DOM
import {delayload} from 'react-delayload'
componentDidMount() {
let images = React.findDOMNode(this.refs.raw).querySelectorAll("img")
// images is not a real array, and using forEach will not work
for (let i = 0; i < images.length; ++i) {
delayload(images[i])
}
}
Options
data_attribute
: Name of the data attribute for storing original SRC value. Default as 'original'height
: Height of placeholder block. Default as 0threshold
: Setting threshold causes image to load N pixels before it appears on viewport. Default as 0Full example ./example/test-dom.jsx
##Demo Run the server
node ./example/server.js
DEMO Links
##License
FAQs
A library offering delay-loading of images for React, same as Lazyload for jQuery. Moreover, offering a compatible function using plain javascript for manipulating HTML content directly.
The npm package react-delayload receives a total of 2 weekly downloads. As such, react-delayload popularity was classified as not popular.
We found that react-delayload demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.