cya dummyObj
This commit is contained in:
parent
74f36a093b
commit
64212512ca
|
@ -78,11 +78,7 @@ export function proxyLazy<T = AnyObject>(factory: () => T, attempts = 5, isChild
|
||||||
if (!isChild) setTimeout(() => isSameTick = false, 0);
|
if (!isChild) setTimeout(() => isSameTick = false, 0);
|
||||||
|
|
||||||
// Define the function in an object to preserve the name after minification
|
// Define the function in an object to preserve the name after minification
|
||||||
const dummyObj = {
|
const proxyDummy = ({ ProxyDummy() { } }).ProxyDummy;
|
||||||
ProxyDummy() { }
|
|
||||||
} as { ProxyDummy: any; };
|
|
||||||
|
|
||||||
const proxyDummy = dummyObj.ProxyDummy;
|
|
||||||
Object.assign(proxyDummy, {
|
Object.assign(proxyDummy, {
|
||||||
[proxyLazyGet]() {
|
[proxyLazyGet]() {
|
||||||
if (!proxyDummy[proxyLazyCache]) {
|
if (!proxyDummy[proxyLazyCache]) {
|
||||||
|
@ -105,8 +101,6 @@ export function proxyLazy<T = AnyObject>(factory: () => T, attempts = 5, isChild
|
||||||
[proxyLazyCache]: void 0 as T | undefined
|
[proxyLazyCache]: void 0 as T | undefined
|
||||||
});
|
});
|
||||||
|
|
||||||
delete dummyObj.ProxyDummy;
|
|
||||||
|
|
||||||
const proxy = new Proxy(proxyDummy, {
|
const proxy = new Proxy(proxyDummy, {
|
||||||
...handler,
|
...handler,
|
||||||
get(target, p) {
|
get(target, p) {
|
||||||
|
|
|
@ -59,11 +59,7 @@ export function proxyInner<T = AnyObject>(
|
||||||
if (!isChild) setTimeout(() => isSameTick = false, 0);
|
if (!isChild) setTimeout(() => isSameTick = false, 0);
|
||||||
|
|
||||||
// Define the function in an object to preserve the name after minification
|
// Define the function in an object to preserve the name after minification
|
||||||
const dummyObj = {
|
const proxyDummy = ({ ProxyDummy() { } }).ProxyDummy;
|
||||||
ProxyDummy() { }
|
|
||||||
} as { ProxyDummy: any; };
|
|
||||||
|
|
||||||
const proxyDummy = dummyObj.ProxyDummy;
|
|
||||||
Object.assign(proxyDummy, {
|
Object.assign(proxyDummy, {
|
||||||
[proxyInnerGet]: function () {
|
[proxyInnerGet]: function () {
|
||||||
if (proxyDummy[proxyInnerValue] == null) {
|
if (proxyDummy[proxyInnerValue] == null) {
|
||||||
|
@ -75,8 +71,6 @@ export function proxyInner<T = AnyObject>(
|
||||||
[proxyInnerValue]: void 0 as T | undefined
|
[proxyInnerValue]: void 0 as T | undefined
|
||||||
});
|
});
|
||||||
|
|
||||||
delete dummyObj.ProxyDummy;
|
|
||||||
|
|
||||||
const proxy = new Proxy(proxyDummy, {
|
const proxy = new Proxy(proxyDummy, {
|
||||||
...handler,
|
...handler,
|
||||||
get(target, p) {
|
get(target, p) {
|
||||||
|
|
Loading…
Reference in a new issue