Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
intersection-observer-amd
Advanced tools
The original, official W3C IntersectionObserver Polyfill, served in AMD.
Because with AMD you can load the IntersectionObserver
only where it's needed, as dependency of another script, e.g. vanilla lazyload.
Insert Require.JS's script (or another AMD module loader) in your page.
<script src="https://cdn.jsdelivr.net/npm/requirejs@2.3.6/bin/r.min.js"></script>
In your script, create a dependencies array.
For example, if you need IntersectionObserver
polyfill and vanilla-lazyload, do like that:
var dependencies = [
"IntersectionObserver" in window
? null
: "https://cdn.jsdelivr.net/npm/intersection-observer-amd@2.0.0/intersection-observer.amd.min.js",
"https://cdn.jsdelivr.net/npm/vanilla-lazyload@11.0.5/dist/lazyload.amd.min.js"
];
Finally, use require to execute your script, having the dependecies loaded in the right order and ready to use.
// _ is always null, since the polyfill is attached to the window object
require(dependencies, function(_, LazyLoad) {
window.ll = new LazyLoad({
elements_selector: ".lazy",
// More options?
});
});
To update this in case the guys at W3C improve their polyfill:
rollup --format=amd --output=intersection-observer.amd.js -- intersection-observer.js
FAQs
A polyfill for IntersectionObserver, served as AMD
The npm package intersection-observer-amd receives a total of 6 weekly downloads. As such, intersection-observer-amd popularity was classified as not popular.
We found that intersection-observer-amd 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
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.