Giter Club home page Giter Club logo

fine-mq's Issues

[Question] $fineMq reactive prop undefined / Register .on callback with plugin

  • I'm submitting a ...
    [x] question about how to use this project

  • Summary
    The Readme tells me that I have the following three instances available:

// Three reactive properties will then be available on Vue instances:
// - $mq is an object that contains the matching state for each alias in the form { [alias]: true/false }.
// - $lastActiveAlias will contain the last alias that was matched and triggered by the listener.
// - $fineMq is a FineMq instance for advanced usages.

Now I can access
context.root.$mq and context.root.$lastActiveAlias but I can't access
context.root.$fineMq because this is undefined.

I am using fineMq as a plugin and I would like to register an .on callback, now I don't really know how I could register that..

import Vue from 'vue'
import FineMq from 'fine-mq'

Vue.use(FineMq, {
  aliases: {
    mobile: 574,
    tablet: [575, 1024],
    mobilefooter: 1024,
    desktop: [1025, 1279],
    mobilenav: 1279,
    widescreen: [1280, 1365],
    ipadpro: [1366],
    landscape: '(orientation: landscape)'
  }

And than later on within a composable of my composition api I would like to register this .on callback, but I don't know how to achieve that.

Help is very welcome. Thank you in advance.

Cheers

Add a «-» modifier that would mean "everything under my upper bound" ?

Example

For default aliases, it would generate for example the following queries:

{
  sm: '(max-width: 680px)',
  'sm+': '(min-width: 681px)',
  md: '(min-width: 681px) and (max-width: 1024px)',
  'md-': '(max-width: 1024px)',
  'md+': '(min-width: 1025px)',
  'md!': '(min-width: 681px)',
  lg: '(min-width: 1025px)',
  'lg-': '(max-width: 1024px)',
  landscape: '(orientation: landscape)',
  an_alias_name: 'screen and (min-width: 380px) and (max-width: 768px)'
}

Special rules

It wouldn't generate a «-» modifier for sm because it's lower bound is 0.
But lg- is generated for lg because lg's upper bound is Infinty.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.