Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
enquire.js
Advanced tools
Readme
enquire.js
is a lightweight, pure javascript library (with no dependencies) for programmatically responding to media queries.
Get the latest build, ready to go:
To install via bower, enter the following at the command line:
bower install enquire
To install via npm, enter the following at the command line:
npm install enquire.js
If you want build from source (and run all unit tests etc):
git clone git://github.com/WickyNilliams/enquire.js.git
cd enquire.js
npm install
grunt
Booya!
The main method you will be dealing with is register
. It's basic signature is as follows:
enquire.register(query /* string */, handler /* object || array || function */);
query
is the CSS media query you wish to respond to, and handler
is an object containing any logic to handle the query. An example of usage is as follows:
enquire.register("screen and (max-width:1000px)", {
match : function() {}, // OPTIONAL
// If supplied, triggered when the media query transitions
// *from an unmatched to a matched state*
unmatch : function() {}, // OPTIONAL
// If supplied, triggered when the media query transitions
// *from a matched state to an unmatched state*.
// Also may be called when handler is unregistered (if destroy is not available)
setup : function() {}, // OPTIONAL
// If supplied, triggered once immediately upon registration of the handler
destroy : function() {}, // OPTIONAL
// If supplied, triggered when handler is unregistered. Place cleanup code here
deferSetup : true // OPTIONAL, defaults to false
// If set to true, defers execution the setup function
// until the media query is first matched. still triggered just once
});
This should be enough to get you going, but please read the full enquire.js documentation if you wish to learn about the other cool features.
Then please don't hesitate to raise an issue, they will all be looked at and tended to.
And for all the cool cats who are prepared to give their time to contribute code, feel free to open a pull request. If you could write unit tests to accompany your pull request that would be pretty sweet, but no worries if not - if it's good enough to be merged in, it's good enough for me to spend a little time to write tests on your behalf :-)
License: MIT (http://www.opensource.org/licenses/mit-license.php)
FAQs
Awesome Media Queries in JavaScript
The npm package enquire.js receives a total of 866,204 weekly downloads. As such, enquire.js popularity was classified as popular.
We found that enquire.js 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.