mirror of
https://github.com/MathMan05/Fermi.git
synced 2026-03-29 09:19:54 +00:00
move the pollyfills
This commit is contained in:
@@ -38,44 +38,7 @@ type favandfreqimp = Omit<
|
||||
| "heard_sound_frecency"
|
||||
| "played_sound_frecency"
|
||||
>;
|
||||
Set.prototype.intersection ||= function <T>(set: Set<T>) {
|
||||
const newSet = new Set();
|
||||
for (const elm of this) {
|
||||
if (set.has(elm)) {
|
||||
newSet.add(elm);
|
||||
}
|
||||
}
|
||||
return newSet;
|
||||
};
|
||||
Set.prototype.difference ||= function <T>(set: Set<T>) {
|
||||
const newSet = new Set();
|
||||
for (const elm of this) {
|
||||
if (!set.has(elm)) {
|
||||
newSet.add(elm);
|
||||
}
|
||||
}
|
||||
return newSet;
|
||||
};
|
||||
Set.prototype.symmetricDifference ||= function <T>(set: Set<T>) {
|
||||
const newSet = new Set();
|
||||
for (const elm of this) {
|
||||
if (!set.has(elm)) {
|
||||
newSet.add(elm);
|
||||
}
|
||||
}
|
||||
for (const elm of set) {
|
||||
if (!this.has(elm)) {
|
||||
newSet.add(elm);
|
||||
}
|
||||
}
|
||||
return newSet;
|
||||
};
|
||||
Set.prototype.isDisjointFrom ||= function <T>(set: Set<T>) {
|
||||
return this.symmetricDifference(set).size === 0;
|
||||
};
|
||||
Set.prototype.union ||= function <T>(set: Set<T>) {
|
||||
return new Set([...this, ...set]);
|
||||
};
|
||||
|
||||
export class Favorites {
|
||||
owner: Localuser;
|
||||
// ----- stuff that needs to store ----
|
||||
|
||||
@@ -6,6 +6,7 @@ import {MarkDown} from "./markdown.js";
|
||||
import {Message} from "./message.js";
|
||||
import {File} from "./file.js";
|
||||
import {I18n} from "./i18n.js";
|
||||
import "./utils/pollyfills.js";
|
||||
if (window.location.pathname === "/app") {
|
||||
window.location.pathname = "/channels/@me";
|
||||
}
|
||||
|
||||
38
src/webpage/utils/pollyfills.ts
Normal file
38
src/webpage/utils/pollyfills.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
Set.prototype.intersection ||= function <T>(set: Set<T>) {
|
||||
const newSet = new Set();
|
||||
for (const elm of this) {
|
||||
if (set.has(elm)) {
|
||||
newSet.add(elm);
|
||||
}
|
||||
}
|
||||
return newSet;
|
||||
};
|
||||
Set.prototype.difference ||= function <T>(set: Set<T>) {
|
||||
const newSet = new Set();
|
||||
for (const elm of this) {
|
||||
if (!set.has(elm)) {
|
||||
newSet.add(elm);
|
||||
}
|
||||
}
|
||||
return newSet;
|
||||
};
|
||||
Set.prototype.symmetricDifference ||= function <T>(set: Set<T>) {
|
||||
const newSet = new Set();
|
||||
for (const elm of this) {
|
||||
if (!set.has(elm)) {
|
||||
newSet.add(elm);
|
||||
}
|
||||
}
|
||||
for (const elm of set) {
|
||||
if (!this.has(elm)) {
|
||||
newSet.add(elm);
|
||||
}
|
||||
}
|
||||
return newSet;
|
||||
};
|
||||
Set.prototype.isDisjointFrom ||= function <T>(set: Set<T>) {
|
||||
return this.symmetricDifference(set).size === 0;
|
||||
};
|
||||
Set.prototype.union ||= function <T>(set: Set<T>) {
|
||||
return new Set([...this, ...set]);
|
||||
};
|
||||
Reference in New Issue
Block a user