Catalog npm
Back to packageRELEASE DETAILS

1.0.3

npm

@0saw/foundation-media-query

Lightweight addon to suit your crazy frontend needs

foundationmatchmediamedia-query
Published7 May 2019
Direct dependencies0
Transitive dependenciesNot calculated

README

Current package documentation

Foundation Media Query

Small little nifty utility to help you work with foundation-sites media queries.

No dependencies. Except for foundation (Da-a-ah). Adds CustomEvent polyfill.

Usage

import mq from "@0saw/foundation-media-query";

document.addEventListener('breakpoint-change', breakpointEventListener);

function breakpointEventListener() {
    if (mq.is('large only')) {
        console.log("You've hit the right spot");
    }
}

You are not obligated to import mq to your scope. Instead you can use event.detail like so:

import "@0saw/foundation-media-query";

document.addEventListener('breakpoint-change', breakpointEventListener);

function breakpointEventListener(event) {
    let mq = event.detail;

    switch (mq.current) {
        case 'medium':
            alert("You've hit the right spot");
            break;
        case 'large':
            alert("Too far");
            break;
        default:
            break;
    }
}

API

mq object contains a few useful things.

Getters

  • mq.current - Gives you the name of current breakpoint
  • mq.currentFull - Gives you all of the breakpoint info that we have. (I.e mq.currentFull.matchMedia will give you matchMedia object. In case you want to do something naughty)
  • mq.landscape - Analog of CSS's (orientation: landscape)
  • mq.portrait - Pretty straight forward
  • mq.retina - DPI is at least 2x

Methods

  • mq.is - Allows you to quickly check current breakpoint
// Either true or false
mq.is('xlarge');

// Won't return true when next breakpoint is active. ([small -> medium] -> large)
mq.is('medium only');

// portrait/ladscape/retina
mq.is('portrait');

FAQ

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 0

Native requirements
0 direct targetsNot calculated transitive count
No declared dependencies in this collected response

Declarations describe requirements; they are not a resolved dependency graph.

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-9NmKB3IpInWuJrDLDVw2afxM1N9xkyOSgjWUzwVyaJkvgSQJqshecl8KhFsSrX89hWCrNZfBaVuQf2weRbw8jg==",
  "shasum": "7b06cef6e026a0fb18e1d702b1b3877c443afe51",
  "tarball": "https://registry.npmjs.org/@0saw/foundation-media-query/-/foundation-media-query-1.0.3.tgz",
  "fileCount": 24,
  "unpackedSize": 79092,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc0VAmCRA9TVsSAnZWagAApFEP/1D6fM3Wf1TI9eDC3wg+\ndulZP5JZEL1IgF0yTaKhcF9EuFunUs+Op6tzbqy4BoqKigKA4c2DzTJAOv8Z\nn0y0NwiTLml4NQpEwB20JAe9ePc3CpI4VrlpkM2FKuT0HyrYYxKXmM7pJy/g\nD1kpc54JyBqB1YxyoafMxxA8TVsdLl60yGB33zmA4bgt66NFqmxA/ZKtst1V\nApMjMAEoJkObCh5HXytRaLngW4Jc0PXwa9f64uiIJ9J+pHwGL6D7vyo0RQhC\nM0xUwOQ31vZm6rcPGl9Z33Ndjtc2se4iVvgrucaPZcG0WU10mGkM467NmEKc\nwA8j8fQ3M07+Kp59+qJtm69/X3rPvvDKPG9jDkCaT6Kgf8THnQ/8XwjXkfOj\n3GW4NQDpVTTwC3/q3BgnwVXnydHg0zxyXHa27CFPdUQwc21tFNXvszzA+LGD\n26KLgDzcWPnkEoy8gDzG6iLhuMP/Qdww8MWfp7VkOtAASK3KofXa/404uNEl\nWI/8g5RkLeWcHnKWPzFEldUVsPCtt0sp7cUjSohToQcDegFao0I8dxt59Ml1\nRlswRkedoBMpiC5yLBHxcA4SB3dA0bQnz+n6lDKv/39R16clN2FWTYTPaaPY\nXJ6Wa26PWABPagFQ/aeieOcr4wux6sm8F8kgbNkz1oANRkLV8fhQK67xg6Tu\nUYIy\r\n=FHH9\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEYCIQDD6wr5ku9SxCdGvw8lrVdDt3iWe8cz6dYZ2U6+6S4bnwIhALHp6t7xrjsI6tlMVI6X5RPabvSY88eRRkzyB1NYRok0"
    }
  ]
}

Repository

PENDING
0saw/foundation-media-query

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:15 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:a5844115015a4de3d44eb0ad45d8bcce7ec3a898e76873065be0dc158fdd4529

Other collected versions

1.0.68 May1.0.57 May1.0.47 May1.0.27 May1.0.15 Apr1.0.05 AprView all collected versions →