com.github.fluorumlabs.disconnect.polymer.IronMediaQuery Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of disconnect-polymer Show documentation
Show all versions of disconnect-polymer Show documentation
Polymer 3 bindings for Disconnect Zero
package com.github.fluorumlabs.disconnect.polymer;
import com.github.fluorumlabs.disconnect.core.annotations.WebComponent;
import com.github.fluorumlabs.disconnect.polymer.elements.IronMediaQueryElement;
import com.github.fluorumlabs.disconnect.zero.component.AbstractComponent;
import com.github.fluorumlabs.disconnect.zero.observable.ObservableEvent;
import js.web.cssom.MediaQueryList;
import js.web.dom.Event;
import javax.annotation.Nullable;
/**
* iron-media-query
can be used to data bind to a CSS media query.
* The query
property is a bare CSS media query. The query-matches
property is a boolean
* representing whether the page matches that media query.
*
* Example:
*
*
<iron-media-query query="(min-width: 600px)" query-matches="{{
* queryMatches}}">
* </iron-media-query>
*
*/
@WebComponent
public class IronMediaQuery
extends AbstractComponent {
/**
* Instantiates a new Iron media query.
*/
public IronMediaQuery() {
super(IronMediaQueryElement.TAGNAME());
}
/**
* The Boolean return value of the media query.
*
* @return the boolean
*/
public boolean queryMatches() {
return getNode().isQueryMatches();
}
/**
* The CSS media query to evaluate.
*
* @return the string
*/
@Nullable
public String query() {
return getNode().getQuery();
}
/**
* The CSS media query to evaluate.
*
* @param query the query
*
* @return the iron media query
*/
public IronMediaQuery query(String query) {
getNode().setQuery(query);
return this;
}
/**
* If true, the query attribute is assumed to be a complete media query string rather than a single media feature.
*
* @return the boolean
*/
public boolean full() {
return getNode().isFull();
}
/**
* If true, the query attribute is assumed to be a complete media query string rather than a single media feature.
*
* @param full the full
*
* @return the iron media query
*/
public IronMediaQuery full(boolean full) {
getNode().setFull(full);
return this;
}
/**
* Query changed.
*/
public void queryChanged() {
getNode().queryChanged();
}
/**
* Query handler.
*
* @param mq the mq
*/
public void queryHandler(MediaQueryList mq) {
getNode().queryHandler(mq);
}
/**
* Fired when the queryMatches
property changes.
*
* @return the observable event
*/
public ObservableEvent queryMatchesChangedEvent() {
return createEvent("query-matches-changed");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy