News Roundup: iOS 4.2 Accelerometer and WebSockets support, Colour.js, W3C drops Web SQL
iOS 4.2 brings Accelerometer and WebSockets support
The recently released iOS 4.2 brings some major additions to mobile Safari, including accelerometer and gyroscope support (through the DeviceOrientation API, WebSockets support, and TrueType fonts support.
For acceleration, there’s now a new “ondevicemotion” event to tinker around with. For the gyroscope (for devices that support it), the data can be captured from the existing “ondeviceorientation” event.
It’s good to see some major progress in mobile Safari, which is now trying to keep pace with the rapid advances Android is making. Mobile Safari, as far as I can tell, is the first mobile browser to implement WebSockets. We’ll see if the impending (and overdue) release of Android 2.3 Gingerbread will do the same.
Colour.js is a small simple library for converting between CSS color formats. What this means is that it can handle anything from named colors (”black”, “white”, etc.) and hexadecimal colors to the newer RGB/RGBA and HSL/HSLA formats.
If you’re already familiar with HSL (hue, saturation, lightness), you’ll know it’s relatively simple to lighten an existing color. For instance, when looking at a prototype of the page you’re working on and deciding that the color hsl(0, 50%, 50%) should be lightened, all you do is increase the lightness value a bit: hsl(0, 50%, 60%)
Colour("rgb(0, 100, 150)").lighten(10).toRGBString(); //"rgb(0,134,201)"
W3C drops the Web SQL Database specification
During the summer the W3C stopped work on the Web SQL spec and slapped this notice on the page: “This document was on the W3C Recommendation track but specification work has stopped. The specification reached an impasse: all interested implementors have used the same SQL backend (Sqlite), but we need multiple independent implementations to proceed along a standardisation path.”
In other words, all the browsers implementing the spec chose to use Sqlite to implement the spec, but the W3C felt it was necessary for at least one browser to implement the spec with another database. The W3C didn’t want to tie the spec to a particular SQL implementation.
Now just last week the W3C put up a bigger and scarier-looking announcement on the page: “Beware. This specification is no longer in active maintenance and the Web Applications Working Group does not intend to maintain it further.” To me this looks indistinguishable from a big old “DEPRECATED” banner at the top of the page, and reactions on Twitter have been similar.
What’s now unclear is how the browsers currently supporting Web SQL databases will handle this. There’s undoubtedly many applications that have now been written that depend on the Web SQL database, and it wouldn’t exactly be pretty having the rug pulled out from under them by removing support. In any case, what is now clear is that the indexedDB spec, just recently implemented in Chrome, is now king.
JS1k #2, Xmas edition
förbind: a service for connecting users, running on node.js with socket.io (by Remy Sharp)
The new BlobBuilder() interface enables Web Workers without external files (and saving HTTP requests!).
Playing with Audio Visualization
Arrhythmia.js, a new take on rhythm validation
xc.js, a framework for 2D canvas games
Announcing cssess: The Bookmarketlet That Finds Unused CSS Selectors
Paren-Free (Brendan Eich’s blog