fix proxies not being constructable

This commit is contained in:
Nuckyz 2024-06-22 06:14:43 -03:00
parent 453c0b62f4
commit b4b67a98da
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
2 changed files with 2 additions and 6 deletions

View file

@ -83,9 +83,7 @@ export function proxyLazy<T = AnyObject>(factory: () => T, attempts = 5, isChild
let isSameTick = true;
if (!isChild) setTimeout(() => isSameTick = false, 0);
// Define the function in an object to preserve the name after minification
const proxyDummy = ({ ProxyDummy() { } }).ProxyDummy;
Object.assign(proxyDummy, {
const proxyDummy = Object.assign(function () { }, {
[SYM_LAZY_GET]() {
if (!proxyDummy[SYM_LAZY_CACHED]) {
if (!get.$$vencordLazyFailed()) {

View file

@ -60,9 +60,7 @@ export function proxyInner<T = AnyObject>(
let isSameTick = true;
if (!isChild) setTimeout(() => isSameTick = false, 0);
// Define the function in an object to preserve the name after minification
const proxyDummy = ({ ProxyDummy() { } }).ProxyDummy;
Object.assign(proxyDummy, {
const proxyDummy = Object.assign(function () { }, {
[SYM_PROXY_INNER_GET]: function () {
if (proxyDummy[SYM_PROXY_INNER_VALUE] == null) {
throw new Error(errMsg);