fix: MediaQueryList addEventListener polyfill

This commit is contained in:
GyDi
2022-11-13 10:27:26 +08:00
parent 320ac81f48
commit fd6633f536
2 changed files with 22 additions and 0 deletions

21
src/utils/polyfill.ts Normal file
View File

@@ -0,0 +1,21 @@
// matchMedia polyfill for macOS 10.15
if (
window.MediaQueryList &&
!window.MediaQueryList.prototype.addEventListener
) {
window.MediaQueryList.prototype.addEventListener = function (
name: string,
callback: any
) {
this.addListener(callback);
};
window.MediaQueryList.prototype.removeEventListener = function (
name: string,
callback: any
) {
this.removeListener(callback);
};
}
export {};