On Sat, Aug 21, 2010 at 00:57, Chris Marrin <firstname.lastname@example.org>
Currently the spec shows two event interfaces: WebGLContextLostEvent and WebGLContextRestoredEvent. Other Event generators in HTML tend to use a single Event object with many event types. For instance, there is a MouseEvent object with event types like "click", "mousedown", "mouseup", etc.
Looks good but I think event type and status code should be separated into two different fields.
Consider using one handler for all three events, the context creation error case would require 3 comparisons instead of one, it's confusing and error-prone (easy to forget one) when you only care about context creation error itself.
unsigned short type - one of CONTEXT_LOST, CONTEXT_RESTORED or CONTEXT_ERROR
unsigned short statusCode - when type is CONTEXT_ERROR, one of NOT_AVAILABLE, NOT_ENABLED or OTHER_ERROR