
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.
checkMQ utilises matchMedia event listeners to provide you with access to media queries in JavaScript as you would in CSS.
Include checkMQ in your project. You can either use the script in the traditional method like so:
<script src="checkMQ.min.js"></script>
or use requireJS, webpack etc like so:
var checkMQ = require('checkmq.min.js');
If using NPM to manage dependencies you can do the following:
npm install checkmq
Each function that needs access the defined media queries should have theMQ passed through as a parameter. The value of theMQ will change when it matches one of the predefined media queries.
var testFunction = function (theMQ) {
if (theMQ === 'mqCore') {
console.log('mqCore');
} else if (theMQ === 'mq600') {
console.log('mq600');
} else if (theMQ === 'mq768') {
console.log('mq768');
} else if (theMQ === 'mq960') {
console.log('mq960');
} else if(theMQ === 'mq1200') {
console.log('mq1200');
}
};
var anotherTestFunction = function (theMQ) {
if (theMQ === 'mqCore') {
alert('this is a small screen device');
}
};
Each function that requires access to theMQ must be passed the addFunctions method which adds the appropraite matchMedia listeners. It's important that this is the last method called.
checkMQ.addFunctions([
testFunction,
anotherTestFunction
]);
For IE 9 support you can use Weblinc's Media.match Polyfill.
FAQs
Media Queries in JavaScript
We found that checkmq demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.