mirror of
https://github.com/go-gitea/gitea
synced 2025-10-27 01:18:27 +00:00
Backport #34025 by wxiaoguang Fix #33407 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -16,3 +16,19 @@ try {
|
||||
return intlNumberFormat(locales, options);
|
||||
};
|
||||
}
|
||||
|
||||
export function weakRefClass() {
|
||||
const weakMap = new WeakMap();
|
||||
return class {
|
||||
constructor(target: any) {
|
||||
weakMap.set(this, target);
|
||||
}
|
||||
deref() {
|
||||
return weakMap.get(this);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (!window.WeakRef) {
|
||||
window.WeakRef = weakRefClass() as any;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user