index.js
function Mql(query, values){
  var self = this;
  if(dynamicMatch){
    var mql = dynamicMatch.call(window, query);
    this.matches = mql.matches;
    this.media = mql.media;
    // TODO: is there a time it makes sense to remove this listener?
    mql.addListener(update);
  } else {
    this.matches = staticMatch(query, values);
    this.media = query;
  }

  this.addListener = addListener;
  this.removeListener = removeListener;
  this.dispose = dispose;

  function addListener(listener){
    if(mql){
      mql.addListener(listener);
    }
  }

  function removeListener(listener){
    if(mql){
      mql.removeListener(listener);
    }
  }

  // update ourselves!
  function update(evt){
    self.matches = evt.matches;
    self.media = evt.media;
  }

  function dispose(){
    mql.removeListener(update);
  }
}
function Mql(query, values){
  var self = this;
  if(dynamicMatch){
    var mql = dynamicMatch.call(window, query);
    this.matches = mql.matches;
    this.media = mql.media;
    // TODO: is there a time it makes sense to remove this listener?
    mql.addListener(update);
  } else {
    this.matches = staticMatch(query, values);
    this.media = query;
  }

  this.addListener = addListener;
  this.removeListener = removeListener;
  this.dispose = dispose;

  function addListener(listener){
    if(mql){
      mql.addListener(listener);
    }
  }

  function removeListener(listener){
    if(mql){
      mql.removeListener(listener);
    }
  }

  // update ourselves!
  function update(evt){
    self.matches = evt.matches;
    self.media = evt.media;
  }

  function dispose(){
    mql.removeListener(update);
  }
}
function Mql ( query , values ) { var self = this ; if ( dynamicMatch ) { var mql = dynamicMatch . call ( window , query ) ; this . matches = mql . matches ; this . media = mql . media ; // TODO: is there a time it makes sense to remove this listener? mql . addListener ( update ) ; } else { this . matches = staticMatch ( query , values ) ; this . media = query ; } this . addListener = addListener ; this . removeListener = removeListener ; this . dispose = dispose ; function addListener ( listener ) { if ( mql ) { mql . addListener ( listener ) ; } } function removeListener ( listener ) { if ( mql ) { mql . removeListener ( listener ) ; } } // update ourselves! function update ( evt ) { self . matches = evt . matches ; self . media = evt . media ; } function dispose ( ) { mql . removeListener ( update ) ; } }
our fake MediaQueryList
our fake MediaQueryList