wip: more compat tweaks

This commit is contained in:
Evan You
2021-04-22 17:30:54 -04:00
parent 7e0224aa8c
commit 6f8fe4eac9
6 changed files with 29 additions and 10 deletions

View File

@@ -345,8 +345,13 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
hasOwn(globalProperties, key))
) {
if (__COMPAT__) {
const val = globalProperties[key]
return isFunction(val) ? val.bind(instance.proxy) : val
const desc = Object.getOwnPropertyDescriptor(globalProperties, key)!
if (desc.get) {
return desc.get.call(instance.proxy)
} else {
const val = globalProperties[key]
return isFunction(val) ? val.bind(instance.proxy) : val
}
} else {
return globalProperties[key]
}