[whatwg] Callback driven initialization of canvas

Technically in gecko today CAPS should be able to squish canvas
methods per domain (not tested, but ask mao about offering a feature
in noscript for it).

i don't think callbacks would improve things....

On 10/21/08, Fabien Meghazi <agr at amigrave.com> wrote:
> Hi all,
>
> <disclaimer>
>     Please forgive me if what I say is silly.
> </disclaimer>
>
> Undoubtedly, in the future, canvas will be used for good stuff but
> also for nasty stuff.
> Of course, how we consider nasty stuff is a personal feeling.
> I don't like ads. Especially flash ads. This is why I use Firefox
> extension flash block (amongs other reasons)
> I'm sure in the future we will see canvas ads poping everywhere, and
> here's my concern :
>
> Will it be possible for the browsers to allow an extension such as
> canvas block ?
>
> My understanding is that it won't be possible (please correct me if
> I'm wrong, I'm not an expert) as the initialization of a canvas
> context is done as follow :
>
> var canvas = document.getElementById('tutorial');
> if (canvas.getContext){
>   var ctx = canvas.getContext('2d');
>   // drawing code here
> } else {
>   // canvas-unsupported code here
> }
>
> But if the initialization of the canvas tag was callback driven, then
> I guess it would be possible to do a canvas block.
>
> var canvas = document.getElementById('tutorial');
> if (canvas.getContext){
>   canvas.getContext('2d', function(ctx) {
>        // drawing code here
>   });
> } else {
>   // canvas-unsupported code here
> }
>
> With this scheme, I guess it would be possible to hook the getContext
> function and do whathever with the callback function (eg: call it when
> user click the canvas element like flash block)
>
>
> --
> Fabien Meghazi
>
> Website: http://www.amigrave.com
> Email: agr at amigrave.com
> IM: amigrave at gmail.com
>

-- 
Sent from Gmail for mobile | mobile.google.com

Received on Tuesday, 21 October 2008 13:04:06 UTC