Re: XMLHttpRequest Priority Proposal

On Fri, Apr 16, 2010 at 1:37 AM, Anne van Kesteren <annevk@opera.com> wrote:

> On Fri, 16 Apr 2010 17:30:04 +0900, Mike Belshe <mbelshe@google.com>
> wrote:
>
>> On Thu, Apr 15, 2010 at 11:00 PM, Anne van Kesteren <annevk@opera.com
>> >wrote:
>>
>>> Other than that I wonder if we should maybe simply use string values to
>>>
>>> make it easier to extend this if we ever need to.
>>>
>>
>> The thing I don't like about that is the error condition of what happens
>> when someone sets it to "HIHG"  (misspelled).
>>
>
> 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?


>
> 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
   }

Mike


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

Received on Friday, 16 April 2010 09:03:39 UTC