Merge branch 'immediate-finds' into immediate-finds-modules-proxy
This commit is contained in:
commit
d55770797a
|
@ -56,8 +56,9 @@ const handler: ProxyHandler<any> = {
|
||||||
return keys;
|
return keys;
|
||||||
},
|
},
|
||||||
getOwnPropertyDescriptor: (target, p) => {
|
getOwnPropertyDescriptor: (target, p) => {
|
||||||
if (typeof p === "string" && UNCONFIGURABLE_PROPERTIES.includes(p))
|
if (typeof p === "string" && UNCONFIGURABLE_PROPERTIES.includes(p)) {
|
||||||
return Reflect.getOwnPropertyDescriptor(target, p);
|
return Reflect.getOwnPropertyDescriptor(target, p);
|
||||||
|
}
|
||||||
|
|
||||||
const descriptor = Reflect.getOwnPropertyDescriptor(target[SYM_LAZY_GET](), p);
|
const descriptor = Reflect.getOwnPropertyDescriptor(target[SYM_LAZY_GET](), p);
|
||||||
if (descriptor) Object.defineProperty(target, p, descriptor);
|
if (descriptor) Object.defineProperty(target, p, descriptor);
|
||||||
|
@ -79,9 +80,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()) {
|
||||||
|
|
|
@ -31,8 +31,9 @@ const handler: ProxyHandler<any> = {
|
||||||
return keys;
|
return keys;
|
||||||
},
|
},
|
||||||
getOwnPropertyDescriptor: (target, p) => {
|
getOwnPropertyDescriptor: (target, p) => {
|
||||||
if (typeof p === "string" && UNCONFIGURABLE_PROPERTIES.includes(p))
|
if (typeof p === "string" && UNCONFIGURABLE_PROPERTIES.includes(p)) {
|
||||||
return Reflect.getOwnPropertyDescriptor(target, p);
|
return Reflect.getOwnPropertyDescriptor(target, p);
|
||||||
|
}
|
||||||
|
|
||||||
const descriptor = Reflect.getOwnPropertyDescriptor(target[SYM_PROXY_INNER_GET](), p);
|
const descriptor = Reflect.getOwnPropertyDescriptor(target[SYM_PROXY_INNER_GET](), p);
|
||||||
if (descriptor) Object.defineProperty(target, p, descriptor);
|
if (descriptor) Object.defineProperty(target, p, descriptor);
|
||||||
|
@ -56,9 +57,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