Re: XMLHttpRequest Priority Proposal

On Fri, 16 Apr 2010 18:03:08 +0900, Mike Belshe <mbelshe@google.com> wrote:
> On Fri, Apr 16, 2010 at 1:37 AM, Anne van Kesteren <annevk@opera.com>  
> wrote:
>> I didn't actually propose an error condition and I'll note that your
>> setPriority() proposal didn't handle errors either. E.g. what happens  
>> when I pass 20 as argument?
>
> Fair enough. :-)
>
> What I wanted was an enum, but I don't believe there is a way to do  
> enums, right?

Not currently, no.


>> I think easiest would be to just ignore the setting as e.g. lineCap and
>> lineJoin on the canvas 2D API do. Then errors are gracefully handled  
>> and by
>> checking what priority is after setting you can see whether the
>> implementation supports the feature.
>
> I'd take whatever people like most.  Personally, I don't like using  
> strings for enums, but I can live with it.
>
> So you're proposing something like:
>
>    var my_priority = "HGIH";
>    xhr.priority = my_priority;
>    if (xhr.priority != my_priority)  {
>      // we detected an error
>    }

Yeah. Basically using strings makes it easier to extend the API going  
forward as numbers start clashing pretty soon.


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Monday, 19 April 2010 05:37:47 UTC