Skip to content

Commit

Permalink
Improves jsdoc, fixes IE issue
Browse files Browse the repository at this point in the history
  • Loading branch information
akolson committed Oct 12, 2022
1 parent b16c125 commit 68266f0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/useKResponsiveWindow/MediaQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class MediaQuery {
* @returns {Object} Media query list
*/
mediaQueryList() {
return window.matchMedia(this.query);
return window.matchMedia(this.query).addListener;
}

/**
Expand All @@ -43,7 +43,12 @@ export default class MediaQuery {
if (this.isNuxtServerSideRendering()) {
return;
}
this.mediaQueryList().addEventListener('change', this.handler);

if (this.mediaQueryList().addEventListener) {
this.mediaQueryList().addEventListener('change', this.handler);
} else {
this.mediaQueryList().addListener('change', this.handler);
}

return {
mediaQueryList: this.mediaQueryList(),
Expand Down

0 comments on commit 68266f0

Please sign in to comment.