Comments (6)
The use case for this is really having a dictionary that is passed to .postMessage().
Today, we use any data
:
interface WhatEver{
void postMessage(DOMString url, any data, NfcMessageDeliveredCallback);
}
But what I want is something like:
transferable dictionary WhateverData {
}
interface WhatEver{
void postMessage(DOMString url, WhateverData data, someCallBack);
}
When WhateverData.postMessage()
is invoked, the structured clone algo would be run on WhateverData
.
cc: @kenchris
from webidl.
Is the idea to only clone some of the dictionary's properties but not all of them?
Or is the idea to not change UA behavior at all from what it would be with "any" and invoking the structured clone algorithm in prose, so this would just be a form of documentation?
from webidl.
Is the idea to only clone some of the dictionary's properties but not all of them?
Yes, this is what I was thinking.
Or is the idea to not change UA behavior at all from what it would be with "any" and invoking the structured clone algorithm in prose, so this would just be a form of documentation?
That's what I'm kinda hoping we can discuss in this bug. If you are passing a transferable Dictionary, then I think it would be fine to just throw out all the unknown stuff in the cloning process.
from webidl.
Yes, this is what I was thinking.
OK. Note that you can already do this by having the dictionary in the IDL and then in prose converting the dictionary to a JS value and then structured cloning that value. It's a bit nonobvious, but quite possible.
Is this something people commonly want to do?
from webidl.
OK. Note that you can already do this by having the dictionary in the IDL and then in prose converting the dictionary to a JS value and then structured cloning that value. It's a bit nonobvious, but quite possible.
Agree - it's certainly doable. Just figured it would be cleaner to take it out of prose.
Is this something people commonly want to do?
I don't think it's very common - but I've seen it come up a few times in various context/discussions. I'll see if I can gather more real examples over time.
from webidl.
(closing for now ... thanks for clarifications @bzbarsky!)
from webidl.
Related Issues (20)
- Language-independent definition of interfaces should mention how to create instances HOT 5
- Meta: npm warnings HOT 1
- Definition name uniqueness requirement omits mixins
- Suggestion: forbid ECMA-262/402-defined global names for some named constructs HOT 2
- Nullable ObservableArray attributes are not supported HOT 1
- Make ObservableArray "subclassable" HOT 3
- Definition of {} is slightly ambiguous HOT 2
- Named properties object [[GetOwnProperty]] conflicts with class string HOT 1
- Add `toggle()` and `replace()` methods to `setlike` HOT 1
- Allowing throwing an exception with a specific message HOT 5
- Offer [[ArrayBufferDetachKey]] abstraction?
- Truncation in "convert a Web IDL arguments list to an ECMAScript arguments list" seems (potentially) incorrect
- Dictionary with required members as optional argument HOT 4
- "byte length of a buffer source type" needs updating for resizable and detached buffers HOT 9
- Intent to use BigInt/numeric union in WebNN HOT 6
- CreateMethodProperty removed from Ecma262 HOT 1
- Disallow FrozenArray<> in argument lists, and maybe dictionaries and return types HOT 4
- Declaration of dictionaries with dynamic keys identified by type, but not by name HOT 6
- Should [SameObject] be allowed with FrozenArray<T>? HOT 5
- Declaration of dictionaries with dynamic keys identified by type, but not by name HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webidl.