Re: [ResourceTiming] Are PerformanceResourceTiming instances supposed to have a serializer?

I am +1 on the idea of a toJSON method (or other serializer method) both at the high level window.performance object and for each PerformanceEntry object.

Peter

On Aug 17, 2014, at 8:42 PM, Boris Zbarsky <bzbarsky@MIT.EDU> wrote:

> On 8/17/14, 4:46 PM, Arvind Jain wrote:
>> So should I add the toJSON() method to PerformanceResourceTiming
>> object and define is as:
>> 
>> toJSON() method:
>> Returns a json object representing the PerformanceResourceTiming object.
> 
> What you should do is define a serializer.  See http://heycam.github.io/webidl/#idl-serializers and I suspect what you want here is:
> 
>  serializer = { attribute };
> 
> for interfaces that don't inherit from something that needs serialization but want to serialize all their own attributes or
> 
>  serializer = { inherit, attribute };
> 
> for ones that want to serialize their own attributes plus whatever their parent interface serializes.  This will automatically create a toJSON method that does the right things for you.
> 
>> In fact should I define it on PerformanceEntry itself (as well as on
>> window.performance.timing) to cover all Performance objects?
> 
> I suggest you test what UAs do and whether the spec you write is compatible with that.
> 
> Gecko does have a serializer on PerformanceEntry and on PerformanceTiming, for what that's worth.
> 
> -Boris
> 
> 

Received on Saturday, 30 August 2014 16:37:50 UTC