[mediacapture-main] WebIDL serializer has been deprecated in favor of toJSON operation

tobie has just created a new issue for https://github.com/w3c/mediacapture-main:

== WebIDL serializer has been deprecated in favor of toJSON operation ==
Hi!

We recently [deprecated WebIDL serializers][0]. You can now directly specify [toJSON operations][1] instead, which you previously weren't allowed to do.

To deal with common cases, we added a new [\[Default\] extended attribute][2] which triggers the [default toJSON operation][3] that behaves similarly to how `serializers={attributes}` or `serializers={attributes, inherit}` used to. That is, it serializes all attributes that are of a [JSON type][4] into a vanilla JSON object.

It seems only the following interface in this spec is impacted by this change:

- [ ] [`MediaDeviceInfo`](https://w3c.github.io/mediacapture-main/getusermedia.html#idl-def-mediadeviceinfo)

It's a good candidate for the [default toJSON operation][3], so the below should be all you need:

```webidl
[Exposed=Window]
interface MediaDeviceInfo {
    readonly attribute DOMString       deviceId;
    readonly attribute MediaDeviceKind kind;
    readonly attribute DOMString       label;
    readonly attribute DOMString       groupId;
    [Default] object toJSON();
};
```

I'm sorry for the inconvenience this causes, but our hope is that this ultimately makes things a lot simpler and clearer for everybody.

Please feel free to reach out if you have any questions.

Thanks!

[0]: https://github.com/heycam/webidl/commit/a505f33
[1]: https://heycam.github.io/webidl/#idl-tojson-operation
[2]: https://heycam.github.io/webidl/#Default
[3]: https://heycam.github.io/webidl/#es-default-tojson
[4]: https://heycam.github.io/webidl/#dfn-json-types

Please view or discuss this issue at https://github.com/w3c/mediacapture-main/issues/469 using your GitHub account

Received on Thursday, 22 June 2017 11:48:16 UTC