Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
network-information-api-polyfill
Advanced tools
An attempt to create polyfill for this specification. Polyfill is based on pinging some url and latency analysis. These are pretty rough measurements. But better than nothing.
npm i -S network-information-api-polyfill
or just
<script src="dist/main.js"></script>
Then you need to initialize it
new NetworkInformationApiPolyfill().then(connection => {
console.log(connection); // or navigator.connection
connection.addEventListener('change', e => {
console.log('change', e);
});
});
Polyfill must do the first request, to get information about network. So you can't use it synchronously, only using promise.
You can pass options during initialization:
new NetworkInformationApiPolyfill({
// here
});
Type: number
Default: 5000
Timeout of request. After this time, the network will be considered unavailable (navigator.connection.type === 'none).
Type: number
Default: 6000
A frequency of pinging.
Type: string
Default: ${location.protocol}//network-information-api.surge.sh/1b.txt
An url, that will be pinged. It is strongly recommended to have your own address. It improves the accuracy of measurements in relation to the user of your service.
If you have CSP rules, and you don't want own pingUrl
, you must add url
network-information-api.surge.sh to rule connect-src
.
FAQs
Network information api polyfill
The npm package network-information-api-polyfill receives a total of 17 weekly downloads. As such, network-information-api-polyfill popularity was classified as not popular.
We found that network-information-api-polyfill 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.