
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
responsive-state-manager
Advanced tools
Javascript handling for mediaquery breakpoints.
This small library is a wrapper for matchMedia and matchMedia.listen to easily deal with Media Queries in Javascript.
None.
StateManager relies on window.matchMedia for Media Query checks which is supported by the following browsers:
To support legacy browsers a polyfill is required.
Install it via npm or download the source directly.
npm install responsive-state-manager --save
Classic
Include StateManager.min.js before the closing body tag.
<script src="node_modules/responsive-state-manager/dist/StateManager.min.js"></script>
CommonJS
var StateManager = require("responsive-state-manager");
Initialize it:
var sm = new StateManager();
.register()Registers a listener for a Media Query. The callback function is triggered every time the breakpoint is passed and the state changes. The suplied argument is true or false depending on whether the Media Query matches.
It returns a reference to the Listener Object.
var handler = sm.register("screen and (max-width: 768px)", function (matches) {
// fires every time the state changes
console.log(matches); // true if query matches
});
.deregister()Deregisters an attached listener. Accepts a reference to a listener Object.
sm.deregister(handler);
.matches()You can also check directly if a media query matches.
var mobile = sm.matches("screen and (max-width: 768px)"); // does not attach listener
console.log(mobile); // true/false
FAQs
Javascript handling for mediaquery breakpoints.
We found that responsive-state-manager 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.