mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 10:33:41 -05:00
web: add Iterator.map polyfill for firefox 128
This commit is contained in:
parent
c14c079d44
commit
b63a81ba65
3 changed files with 29 additions and 1 deletions
|
@ -16,6 +16,7 @@
|
||||||
import { StrictMode } from "react"
|
import { StrictMode } from "react"
|
||||||
import { createRoot } from "react-dom/client"
|
import { createRoot } from "react-dom/client"
|
||||||
import App from "./App.tsx"
|
import App from "./App.tsx"
|
||||||
|
import "./util/polyfill.js"
|
||||||
import "./index.css"
|
import "./index.css"
|
||||||
|
|
||||||
createRoot(document.getElementById("root")!).render(
|
createRoot(document.getElementById("root")!).render(
|
||||||
|
|
27
web/src/util/polyfill.js
Normal file
27
web/src/util/polyfill.js
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// gomuks - A Matrix client written in Go.
|
||||||
|
// Copyright (C) 2024 Tulir Asokan
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
if (!Iterator.prototype.map) {
|
||||||
|
Iterator.prototype.map = function(callbackFn) {
|
||||||
|
const output = []
|
||||||
|
let i = 0
|
||||||
|
for (const item of this) {
|
||||||
|
output.push(callbackFn(item, i))
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
return output
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ import svgr from "vite-plugin-svgr"
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
base: "./",
|
base: "./",
|
||||||
build: {
|
build: {
|
||||||
target: ["esnext", "firefox132"],
|
target: ["esnext", "firefox128"],
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
react(),
|
react(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue