-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
structuredClone into (Shared) ArrayBuffer #10468
Comments
This is a duplicate of #3517. |
Related issue at TC39 level for history sake: https://es.discourse.group/t/atomics-waituntil/2083 |
@annevk opened in 2018 and stuck until 2021 (it's 2024 now) ... how is this handling users' requests going? |
There are a great many problems to tackle as you can see from the issue tracker and very few people to go around. If you want to see something happen your best bet is investing the time to make it so. |
I see ... your suggestion is that I create at least 3 PRs to WebKit, Chromium, and Firefox code bases, around an issue stuck in time since 2018 ... sounds reasonable, if I did work for Igalia and there was sponsored interest around it ... 🤷♂️ |
At some point you might want to reflect on why your engagement with standards bodies does not seem to be fruitful. |
@annevk I didn't mean to offend anyone but your message was a bit over my capabilities ... I do work full time already and with a 2yo around there's little extra time for anything else. If I could contribute directly I would but I don't know those code bases inside out like many of you here, or in Igalia, do so ... you basically gently reminded me that's never going to happen and it's a sad resolution to me but surely it's mostly my fault. Anyway, thanks for the pointer, I hope one day that will be closed as fixed. |
What problem are you trying to solve?
I am the maintainer of the polyfill that has 77+ Million downloads per months and most of those "millions" are around the @ungap/structured-clone/json functionality, because this standard doesn't allow to:
postMessage
danceThe idea here is that it's OK to not specify a string representation of the algorithm that's involved, but at least it would be sensible, lovely, useful, to allow such algorithm to work with ArrayBuffer or, even better, SharedArrayBuffer.
The fact I need to make a string out of my polyfill feature, to then fill a buffer with such UTF-16 string, and parse it once received on the other end makes literally no sense to me ... if I could just have a
structuredClone.toBuffer
and astructuredClone.fromBuffer
everything would be smoother and better for a plethora of projects using Workers behind the scene to communicate omplex data to the Main thread, and vice-versa.What solutions exist today?
One needs to use my polyfill to make sense of structuredClone algorithm, and yet tat polyfill can't survive some special case that native algorithm supports.
How would you solve it?
I would add a
structuredCloneView(source)
that returns a view of that buffer andstructuredCloneFrom(bufferOrTypedArray)
that returns cloned data on the receiver.Alternatively, I would add primitives to clone into a buffer, but knowing the desired buffer length AOT (Ahead Of Time) might be tricky, so that previous hints could solve all the issues already.
Anything else?
This API is both wonderful and too hidden behind "core-developers" scene, where it could shine and enable the unthinkable as long as it is usable beside
postMessage
dance.The text was updated successfully, but these errors were encountered: