-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
new-exampleA proposal of the new exampleA proposal of the new example
Description
const quoteless = new Proxy({}, {
get(_, key) {
if(key === Symbol.unscopables) return {}
if(key === "__global") return globalThis
return `${key} `
},
has(_, __) {
return true
}
})
with (quoteless) {
__global.console.log(This + is + black + magic)
}This outputs "This is black magic" to the console.
The way this works is that when a property is accessed then it just gets the name of the property that was accessed. Using with (quoteless) makes all the properties be accessible without quoteless.property. The way we access console.log is by checking if the key is a magic word, such as __global, to access the globalThis.
My explanation is terrible, don't use it in the real repository lol
Rudxain and tj-commitsRudxainpinage404 and Rudxain
Metadata
Metadata
Assignees
Labels
new-exampleA proposal of the new exampleA proposal of the new example