Check toString after loading remote properties
This commit is contained in:
parent
648d3324fb
commit
c50b518493
1 changed files with 9 additions and 4 deletions
|
@ -175,11 +175,16 @@ const proxyFunctionProperties = function (remoteMemberFunction, metaId, name) {
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
get: (target, property, receiver) => {
|
get: (target, property, receiver) => {
|
||||||
if (property === 'toString' && typeof target.toString === 'function') {
|
|
||||||
return target.toString.bind(target)
|
|
||||||
}
|
|
||||||
if (!target.hasOwnProperty(property)) loadRemoteProperties()
|
if (!target.hasOwnProperty(property)) loadRemoteProperties()
|
||||||
return target[property]
|
const value = target[property]
|
||||||
|
|
||||||
|
// Bind toString to target if it is a function to avoid
|
||||||
|
// Function.prototype.toString is not generic errors
|
||||||
|
if (property === 'toString' && typeof value === 'function') {
|
||||||
|
return value.bind(target)
|
||||||
|
}
|
||||||
|
|
||||||
|
return value
|
||||||
},
|
},
|
||||||
ownKeys: (target) => {
|
ownKeys: (target) => {
|
||||||
loadRemoteProperties()
|
loadRemoteProperties()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue