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.
browser-ui-stores
Advanced tools
A collection of stores that monitor the size, orientation, color scheme and scroll of the browser window.
A collection of stores that monitor the size, orientation, color scheme and scroll of the browser window.
Compatible with Server-Side Rendering.
npm install browser-ui-stores
import {prefersColorScheme$} from 'browser-ui-stores';
prefersColorScheme$.subscribe((scheme) =>
console.log(`Preferred color scheme: ${scheme}`),
);
import {makeScreenSizeStore} from 'browser-ui-stores';
const screenSize$ = makeScreenSizeStore({
names: ['sm', 'md', 'lg'],
thresholds: [768, 992],
});
screenSize$.subscribe(({name}) =>
console.log(`Your screen is categorized as ${name}`),
);
import {scrollY$} from 'browser-ui-stores';
const goToTopButton = document.createElement('button');
goToTopButton.type = 'button';
goToTopButton.textContent = 'Go to the top';
goToTopButton.style.position = 'fixed';
goToTopButton.style.bottom = '0';
goToTopButton.style.right = '0';
goToTopButton.addEventListener('click', () => window.scrollTo(0, 0));
scrollY$.subscribe((scrollY) => {
goToTopButton.style.display = scrollY > 10 ? 'inline-block' : 'none';
});
document.body.appendChild(goToTopButton);
import {orientation$} from 'browser-ui-stores';
orientation$.subscribe((orientation) => {
console.log(`Your screen is in ${orientation} mode`);
});
import {makeMediaQueryStore} from 'browser-ui-stores';
const prefersLightTheme$ = makeMediaQueryStore('(prefers-color-scheme: light)');
console.log(prefersLightTheme$.content()); // true or false depending on the browser/system settings.
prefersLightTheme$.subscribe(console.log); // will print true or false immediately and every time the preference changes.
FAQs
A collection of stores that monitor the size, orientation, color scheme and scroll of the browser window.
We found that browser-ui-stores 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.
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.