aframe
aframe copied to clipboard
Schema of single-property component with custom type requires default
Description:
- A-Frame Version: 1.3.0
- Platform / Device: N/A
- Reproducible Code Snippet or URL:
AFRAME.registerComponent("example", {
schema: {
parse(value) {
return value;
},
stringify(value) {
return value.toString();
}
}
});
If you try to create a single-property component with a custom type, it will try to interpret the schema as a multiple-property component (with poor results) unless a default key is also present. It seems to only look for the type and default keys when deciding if a component is multiple property or single property.
Yeah default is necessary (probably we should elaborate on docs). After adding a default is it working for your use case?
It works, more or less. The property is required, but I was able to just make the default invalid. It's not elegant, but it does the job.
Thanks for the info. What do you mean by default invalid? Can you show the full code for the property? Thanks
Closing due to inactivity. Can reopen if necessary