The other day, @mrspeaker tweeted this:
c’mon alert() - just magically be a _bit_ more like console.log and you’d save me a lot of time
This got the creative juices flowing a little and I coded up a small script to overwrite how alert() operates and, if available, it will choose to behave exactly like console.log() by writing to the console instead of popping up the dialog (if it’s available). It still needs some work to support formatted strings in alert() dialogs, for when console.log() isn’t available.
var oldAlert = alert;
alert = function(){
if(window.console != null){
console.log.apply(null, arguments);
} else {
oldAlert.apply(null, arguments);
}
};
What this means now is that you can exclusively use alert() in your code and not have to use console.log() and worry about your JavaScript breaking in browsers that don’t have Firebug or a console.
Find it on GitHub, here.
A few days ago, the Khronos Group published their draft for the WebGL Specification. If you’re not familiar with WebGL, it’s a spec that describes how browsers should expose OpenGL’s powerful 3D APIs to web developers through HTML 5’s <canvas> element and JavaScript.
This is huge news for rich-client and open-web advocates alike: there is so much potential for people to do awesome new things with this platform. Not just some hokey VRML clone for the 21st century, WebGL allows for some very advanced graphics processing by exposing things like shaders which will be written in GLSL and could be loaded in dynamically with javascript via AJAX, or possibly encapsulated in a <script> tag of their own.
Personally, I can’t wait to get started with WebGL and get the juices flowing around some jQuery plugins in this area…
More Reading
- You can read what ArsTechnica has to say about this news here.
- Mozilla has their own comments on the release, here.
-
OpenGL ES’s official page.