diff --git a/src/main.tsx b/src/main.tsx index 08241f4d6f35289afb2cf5060a6441c1e7209954..851001a4adce8f2b5e6c17200a59a2ed653c627b 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -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"; diff --git a/src/utils/polyfill.ts b/src/utils/polyfill.ts new file mode 100644 index 0000000000000000000000000000000000000000..6849151fb9ace50758853a724202f90b89bea00b --- /dev/null +++ b/src/utils/polyfill.ts @@ -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 {};