fix proxies not being constructable
This commit is contained in:
parent
453c0b62f4
commit
b4b67a98da
|
@ -83,9 +83,7 @@ export function proxyLazy<T = AnyObject>(factory: () => T, attempts = 5, isChild
|
||||||
let isSameTick = true;
|
let isSameTick = true;
|
||||||
if (!isChild) setTimeout(() => isSameTick = false, 0);
|
if (!isChild) setTimeout(() => isSameTick = false, 0);
|
||||||
|
|
||||||
// Define the function in an object to preserve the name after minification
|
const proxyDummy = Object.assign(function () { }, {
|
||||||
const proxyDummy = ({ ProxyDummy() { } }).ProxyDummy;
|
|
||||||
Object.assign(proxyDummy, {
|
|
||||||
[SYM_LAZY_GET]() {
|
[SYM_LAZY_GET]() {
|
||||||
if (!proxyDummy[SYM_LAZY_CACHED]) {
|
if (!proxyDummy[SYM_LAZY_CACHED]) {
|
||||||
if (!get.$$vencordLazyFailed()) {
|
if (!get.$$vencordLazyFailed()) {
|
||||||
|
|
|
@ -60,9 +60,7 @@ export function proxyInner<T = AnyObject>(
|
||||||
let isSameTick = true;
|
let isSameTick = true;
|
||||||
if (!isChild) setTimeout(() => isSameTick = false, 0);
|
if (!isChild) setTimeout(() => isSameTick = false, 0);
|
||||||
|
|
||||||
// Define the function in an object to preserve the name after minification
|
const proxyDummy = Object.assign(function () { }, {
|
||||||
const proxyDummy = ({ ProxyDummy() { } }).ProxyDummy;
|
|
||||||
Object.assign(proxyDummy, {
|
|
||||||
[SYM_PROXY_INNER_GET]: function () {
|
[SYM_PROXY_INNER_GET]: function () {
|
||||||
if (proxyDummy[SYM_PROXY_INNER_VALUE] == null) {
|
if (proxyDummy[SYM_PROXY_INNER_VALUE] == null) {
|
||||||
throw new Error(errMsg);
|
throw new Error(errMsg);
|
||||||
|
|
Loading…
Reference in a new issue