Skip to content

[css-typed-om-2] Need an array-buffer custom property type. #136

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

Open
shans opened this issue Mar 11, 2016 · 2 comments
Open

[css-typed-om-2] Need an array-buffer custom property type. #136

shans opened this issue Mar 11, 2016 · 2 comments

Comments

@shans
Copy link
Contributor

shans commented Mar 11, 2016

No description provided.

@tabatkins
Copy link
Member

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 arraybuffer() function that takes the type of the buffer, and a base-64-encoded string for the data.

@shans shans changed the title Need an array-buffer custom property type. [css-typed-om-2] Need an array-buffer custom property type. Apr 4, 2016
@yjbanov
Copy link

yjbanov commented Apr 5, 2020

This can be very handy in Flutter for web. We need an efficient way of passing paint instructions to the paintlet. The paint instructions are typically more than images. In our current Houdini proof of concept we encode these instructions as JSON, but that's inefficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants