fix: MediaQueryList addEventListener polyfill

This commit is contained in:
GyDi committed 2022-11-13 10:27:26 +08:00
1 parent e8b014ea6d
commit afc37c71a6
2 files changed
+22

No files matched your search

+1
View File
@@ -1,6 +1,7 @@
/// <reference types="vite/client" />
/// <reference types="vite-plugin-svgr/client" />
import "./assets/styles/index.scss";
import "@/utils/polyfill";
import React from "react";
import ReactDOM from "react-dom";
+21
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 {};