W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2013

Re: [whatwg] Challenging canvas.supportsContext

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 19 Jun 2013 11:20:32 -0700
Message-ID: <CAAWBYDD66Fg+zk40jXN7iyg6dWFkbMjYrsuN1U019EX==b_prA@mail.gmail.com>
To: Benoit Jacob <jacob.benoit.1@gmail.com>
Cc: WHATWG <whatwg@lists.whatwg.org>
On Wed, Jun 19, 2013 at 11:17 AM, Benoit Jacob <jacob.benoit.1@gmail.com> wrote:
> So let's look at the naive application usage pattern for supportsContext:
>
>   if (canvas.supportsContext("webgl")) {
>     context = canvas.getContext("webgl");
>   }
>
> The problem is that the same can be achieved with just the getContext call,
> and checking whether it succeeded.

The problem that supportsContext() solves, and which was brought up
repeatedly during the drive to add this, is that spinning up contexts
can be expensive.

~TJ
Received on Wednesday, 19 June 2013 18:21:16 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:22 UTC