News roundup: Delayed script execution, Jdrop, $script.js, Amplify

Zakas’s delayed script execution proposal

Nicholas Zakas has revised his proposal for a deferred JavaScript execution attribute. Previously his proposal called for a noexecute attribute, but this has been revised to be a preload attribute.

His proposal is motivated by the lack of any built-in attributes that allow this same behavior. The defer attribute simply defers the execution of code after the DOMContentLoaded event and before the load event, and the async attribute simply tells the script not to be blocking (its default behavior) while downloading and executing, allowing other resources to download.

However, we lack a built-in way of deferring the actual execution of scripts, which would tell them to download but hold off on execution until instructed to do so. This is something the Gmail mobile team first implemented by way of a hack (load the script in a comment block, then strip the comment tags and eval on demand) and something which was incorporated into ControlJS.

Especially with the increased focus on mobile these days, it only makes sense that there would be nothing but support for this proposal, and hopefully we can see it start to creep into browsers in the near future.

Jdrop

Jdrop is a new tool by Steve Souders that allows users of the Mobile Perf bookmarklet to save their on-screen test results to a server, which can be viewed on a nice big desktop monitor.

It was motivated by the fact that it’s no fun to read these test results on a mobile device’s tiny screen. You simply click on the provided “Save to Jdrop” button and away your tests go!

There is one caveat however: you need to authenticate via Oauth, which means you need to login through Twitter or Google or any other account. This might be a bit annoying, but I suppose it’s necessary to prevent abuse.

$script.js

scriptjs is a minimalist attempt at a script loader by Dustin Diaz. Lightweight meaning only 643 bytes!

A very simple test case is loading two scripts, the second of which runs a callback when the script is ready:

$script('foo.js');
$script('bar.js', function() {
  // do stuff with bar.js
});

Another way of doing this is the following:

$script('foo.js');
$script('bar.js', 'bar');

$script.ready('bar', function() {
  // do stuff with bar
});

Diaz ends the post with a comparison with other script loaders, particularly LAB.js:

In particular I wanted to call out the great work done on LAB.js – $script.js is not better or worse. And it is most certainly different. LAB attempts to do some nice cross-browser speed improvements (like downloading via xhr and other crazy browser forks). Hell, we use it here at Twitter, and we love it. The point of $script.js is to get back to the basics of loading script’s w/o blocking other resources, which is where you’ll find the most win.

Amplify

Amplify (on GitHub) is a library to help jQuery components play well together, providing an abstraction layer for data requests, client-side storage, and loose coupling provided by a pub/sub system.

Releases

Node.js 0.4.0 (listen to Ryan Dahl talk about it in the latest node.minutewith)
RequireJS 0.23.0
DOM Monster 1.3.0
PhoneGap 0.9.4

Upcoming Events

Confoo.CA: Web Techno Conference (March 9-11, 2011 in Montreal, Canada)
MobileCampRDU (March 12, 2011 in Durham, North Carolina)
BayJax Open Mic and Steve Souders / Douglas Crockford talks (March 28-29 in Sunnyvale)
JS in SA (April 2, 2011 in South Africa)
codeconf (April 9-10 in San Francisco, US)
Breaking Development: design and development for the mobile web (April 11-12, 2011 in Dallas, TX)
JSConf 2011 (May 2-3, 2011 in Portland, Oregon, US)
NodeConf 2011 (May 5, 2011 in Portland, Oregon, US)
Web Directions Unplugged (May 12–13 2011, Seattle)
jsday (May 12-14, 2011 in Italy)
Mobilism (May 12-13, 2011 in Amsterdam)
TXJS (June 5, 2011 in Texas)
An Event Apart Atlanta (June 13–15, 2011, Atlanta)
Full Frontal (November 11, 2011 in ?)

Tidbits

JSHint is a open-sourced, gentler version of JSLint.
BeerCamp 2011 – scroll the page to see this very cool and different page interaction. If you’re running Chrome, go to about:flags and enable GPU Accelerated Compositing to get more performance (albeit slightly buggy) out of this page (hat tip to @nathansmith).

dotjs is a Greasemonkey-like Chrome extension that allows you to run custom JavaScript based on the filename of the site visited

History.js is a browser history manager that uses newer technologies when available (pushState, etc.) and falls back to a hash-based history when necessary

(pre)Maturely Optimize Your JavaScript

Cross-domain Ajax: Implementation and Considerations

Audio: Closure Versus Prototypal Pattern Deathmatch (A Minute with Brendan)

Giraffe from Hell (WebGL demo)

#-ish – more discussion about the hash tag and browser history, and why you should only use it if it fits your needs

gRaphaël – a JavaScript charts library based on Raphaël

Building Single Page Applications With jQuery’s Best Friends (Backbone.js, Underscore.js, LAB.js, etc)

Is IE9 a modern browser? (see Microsoft’s response)

Canvas From Scratch: Introducing Canvas

960 Grid on jQuery-Mobile

IE9 has plugins for experimental support of indexdb and web-sockets

Paul Irish on surefire DOM Element insertion

Anchor Modeler is a nice Canvas-based modeling tool

NodeJS Tidbits

cluster is a multi-core server manager with plugins support

Blagovest Dachev has written a nice GUI for npm

Re-using Backbone.js Models on the server with Node.js and Socket.io to build real-time apps

node-serialport: node.js + Arduino

BostInnovation interviewed Ryan Grove about his combohandler for node.js

Testing the performance of getter/setter techniques

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • description
  • Reddit
  • TwitThis
  • Simpy
  • StumbleUpon

Leave a Reply




© webdevpublishing 2011