Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
A tiny, high performance viewport position & intersection observation tool. You can watch when elements enter & exit the viewport, or when the viewport itself is at the bottom or top. Use this as a building block for things such as lazy loaders, infinite scrollers, etc.
npm i viewprt
Create new observers and any time its container is scrolled, resized, or mutated, the appropriate callbacks will be triggered when the condition is met.
import { PositionObserver, ElementObserver } from 'viewprt'
const element = document.getElementById('element')
// Observe when an element enters and exits the viewport:
const elementObserver = ElementObserver(element, {
// options (defaults)
container: document.body, // the viewport container element
offset: 0, // offset from the edge of the viewport in pixels
once: false, // if true, observer is detroyed after first callback is triggered
onEnter(element, viewportState) {}, // callback when the element enters the viewport
onExit(element, viewportState) {} // callback when the element exits the viewport
})
// Observe when the viewport reaches its bounds:
const positionObserver = PositionObserver({
// options (defaults)
container: document.body, // the viewport container element
offset: 0, // offset from the edge of the viewport in pixels
once: false, // if true, observer is detroyed after first callback is triggered
onBottom(container, viewportState) {}, // callback when the viewport reaches the bottom
onTop(container, viewportState) {}, // callback when the viewport reaches the top
onMaximized(container, viewportState) {} // callback when the viewport and container are the same size
})
// Stop observing:
positionObserver.destroy()
elementObserver.destroy() // This happens automatically if the element is removed from DOM
// Start observing again:
positionObserver.activate()
elementObserver.activate()
npm run build
npm test
FAQs
A tiny, dependency-free, high performance viewport position & intersection observation tool
We found that viewprt 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.