Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property checking in host objects #1490

Open
wcandillon opened this issue Aug 22, 2024 · 3 comments
Open

Property checking in host objects #1490

wcandillon opened this issue Aug 22, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@wcandillon
Copy link

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.

@wcandillon wcandillon added the bug Something isn't working label Aug 22, 2024
@wcandillon wcandillon changed the title Feature Detection in Host Object Property checking in host objects Aug 22, 2024
@tmikov
Copy link
Contributor

tmikov commented Aug 23, 2024

Hi, unfortunately HostObject does not support the "in" operation, because the HostObject API doesn't allow it: it only has 'get(), set()andgetPropertyNames(). There is no has()` method.

This is unfortunately by design. See here:

// For compatibility with polyfills we want to pretend that all HostObject

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.

@wcandillon
Copy link
Author

wcandillon commented Aug 23, 2024 via email

@tmikov tmikov added enhancement New feature or request and removed bug Something isn't working labels Aug 24, 2024
@tmikov
Copy link
Contributor

tmikov commented Aug 24, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants