diff --git a/lib/useKResponsiveWindow/MediaQuery.js b/lib/useKResponsiveWindow/MediaQuery.js index 36de95ce8..7c14138ec 100644 --- a/lib/useKResponsiveWindow/MediaQuery.js +++ b/lib/useKResponsiveWindow/MediaQuery.js @@ -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; } /** @@ -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(),