Skip to content

Commit

Permalink
Make matchMedia static and update doc for closure
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelauritsen committed Jul 22, 2024
1 parent 11d7b23 commit 1c203b9
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/layout/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@
*
* @private
*/
MaterialLayout.prototype.matchMedia_ = function(query) {
MaterialLayout.matchMedia_ = function(query) {
return window.matchMedia(query);
};

MaterialLayout.screenSizeMediaQuery_ = MaterialLayout.prototype.matchMedia_(
MaterialLayout.screenSizeMediaQuery_ = MaterialLayout.matchMedia_(
/** @type {string} */ (MaterialLayout.prototype.Constant_.MAX_WIDTH));
MaterialLayout.screenSizeMediaQuery_.onchange = screenSizeHandler;

Expand Down Expand Up @@ -188,16 +188,11 @@
}
};

/**
* @typedef {Object} Matchable
* @property {boolean} matches - Indicates if the media query condition is met.
*/

/**
* Handles screen size changes by updating the layout and drawer elements
* based on the media query change event status.
*
* @param {Matchable} m - is any object that provides matches
* @param {!MediaQueryList|!MediaQueryListEvent} m - is any object that provides matches
*
*/
function screenSizeHandler(m) {
Expand Down

0 comments on commit 1c203b9

Please sign in to comment.