[push-api] Define a serializer for PushSubscription (#125)

Given this snippet:
```
swRegistration.pushManager.subscribe().then(function (subscription) {
  var x = JSON.stringify(subscription);
});
```

What is `x` meant to be? Today it's `"{}"` because attributes on an interface don't get serialized by default. This makes sense for DOM objects, but much less so for POD-like structures like this.

Since it's likely that developers will want to send all data to their application server, we should define [a serializer](http://heycam.github.io/webidl/#idl-serializers) for the interface.

I believe we can do this as follows:
```
interface PushSubscription {
  ...
  serializer = { endpoint, subscriptionId };
}
```

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/push-api/issues/125

Received on Tuesday, 17 March 2015 13:27:35 UTC