Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[css-typed-om-2] Need an array-buffer custom property type. #136
To elaborate: previously we thought we might add a "worklet cache" that was some global dict of structured-clonable values, and worklets could list keys from the cache that they depend on and get updated on change, just like they can with custom properties. It was intended that you use this for things like images, fonts, etc.
In general, this doesn't offer anything that just using a custom property does - just set the custom prop on the root element, give it the value you want, and make your worklet depend on that prop. Custom props are better in some ways, too, as they're not required to be global - you can change the value being passed in for different subtrees if necessary.
The cache did have the advantage that it fairly naturally supported various types of binary data, like images. But we're adding image and font objects to the Typed OM, and they're allowed in the custom property grammar, so you can just pipe those through that way. One big unfilled hole is arbitrary binary data, like a big list of vertexes you want to use in a PaintWorklet. The cache object could just take an ArrayBuffer, but you can't put that into a custom prop right now.
So, we need to introduce some Typed OM value that wraps an array buffer. This is intended to be set and read via the Typed OM, so it doesn't necessarily need a serialization, but it might be nice to provide such - I suggest an