Property checking in host objects
wcandillon opened this issue · 3 comments
Bug Description
The behaviour described below has been noticed by us since many years now but we never had an issue with it until now.
Now that we run three.js on top of host objects, we have less flexibility on how they could behave.
I also acknowledge that this wouldn't be a problem if we were using native state instead of host objects.
The following:
!!("put any name" in hostHobject) // Will always return true no matter what
@tmikov there is probably a semantic that I am missing here, if you could refresh me on what is the semantic here? Could this be a bug? I'm not sure.
Hi, unfortunately HostObject does not support the "in" operation, because the HostObject API doesn't allow it: it only has 'get(),
set()and
getPropertyNames(). There is no
has()` method.
This is unfortunately by design. See here:
Line 1277 in 05d9e75
Yes, HostObject is awful... (though this probably doesn't help you).
I am not sure what a solution here would look like. I am open to suggestions.
We can't change the current behavior because that would break the existing API contract. However we can do betterL we discussed it and decided to add a has()
method to HostObject. Unfortunately, it will take some time for this to propagate to users.
Meanwhile I hope you can read the property and compare it to undefined
to get a similar result.