fix: matchMedia().addEventListener #258 (#296)

This commit is contained in:
MoeShin 2022-11-22 09:25:39 +08:00 committed by GitHub
parent e4e16999c8
commit 4046f143f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,27 @@
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Clash Verge</title>
<script>
(function () {
var _matchMedia = window.matchMedia;
window.matchMedia = function () {
var v = _matchMedia.apply(null, arguments);
if (!v.addEventListener) {
v.addEventListener = function () {
if (arguments.length < 2 || arguments[0] !== "change") {
console.error("Cannot proxy addEventListener:", arguments);
return;
}
if (arguments.length > 2) {
console.warn("Proxy addEventListener:", arguments);
}
v.addListener(arguments[1]);
};
}
return v;
};
})();
</script>
</head>
<body>
<div id="root"></div>