Web Info & Tutorials

February 5th, 2007

LASZLO WEBTOP

David Temkin has previewed Laszlo Webtop “a commercial product that enables the delivery of multiple windowed applications in any browser. You can think of it as a framework for creating and delivering a browser-based “desktop” or “WebOS” experience, in which each application is written using OpenLaszlo. Laszlo Webtop provides the overall user interface, the glue to integrate the applications, and the server pieces that make it possible to integrate existing data and services into a seamless Web-based desktop, or webtop.”

The final release will support OpenLaszlo 4, which will mean support for both Ajax and Flash applications.

Laszlo Webtop

February 5th, 2007

THE WINDOW.ONLOAD PROBLEM REVISITED

Peter Michaux has written a detailed post on the window.onload problem:

The goal of unobtrusive JavaScript programming it to separate the JavaScript behavior from from the HTML content and is analogous to the goal of unobtrusive CSS design to separate the CSS presentation from the HTML content. Separation of presentation and content has been possible for years but there is one wrinkle standing in the way of completely separating the behavior. This article is about previously suggested techniques to enable this separation, their problems and a new option that combines the strengths of the current techniques with an extra bonus into a new robust solution.

Peter goes into detail on the various tricks and hacks that differ between browsers in many cases.

He discusses:

  • Just putting a script tag where you need it
  • DOMContentLoaded for some browsers
  • script tag with an onreadystatechange
  • document.readyState
  • DOM Polling (e.g. YUI event library)

Summary

Event handler attributes in the HTML are the most robust but do not allow separation of concerns.

The bottom script technique works cross browser based on de facto standard browser behavior but has a compromise in separation of concerns. Must remember to put the JavaScript element at the bottom of each page.

Dean Edwards script allows for complete separation but is brittle when looking towards the future. Old and exotic browsers will not enliven a page until window.onload.

DOM polling is cross browser, robust and allows for complete separation of concerns. In extremely rare cases a dummy element can help the code know that content is available.

The Fork JavaScript library svn trunk now implements DOM polling with DOMContentloaded and window.onload fallbacks as well as the ancestor walk as discussed. These features will be part of Fork release 0.2.0.

February 5th, 2007

DJAX: LANGUAGE ON TOP OF JAVASCRIPT

Hamish Friedlander has created djax, a module polyglot that takes cipher cursive in a javascript superset, and turns it into regular-ol’ javascript.

What does the module essay to provide you?

  • Continuations (ish). Suspend a javascript duty anywhere, and move it again after easily. Code coetaneous ajax without protection the browser. sleep().
  • Threads. Execute long-running jobs in the background, patch animations separate smoothly in the foreground. No browser-lockups.
  • Generators. Iterate over anything. Easily.
  • ExtendedArguments. Variable-length arguments, keyword arguments, choice values. Without the discompose of the arguments property
  • Compatibility. Any javascript duty should ease impact dustlike titled from or translated finished djax. Mochikit’s consciousness effort passes every tests after translation.

You crapper wager a threading warning in action.

JAVASCRIPT:

  1.  
  2. test = function() {
  3.     var primes1 = new Thread( 20, target=calcPrimes ) ;
  4.     primes1.elid = “res1″ ;
  5.     primes1.start() ;   
  6.  
  7.     var primes2 = new Thread( 10, target=calcPrimes ) ;
  8.     primes2.elid = “res2″ ;
  9.     primes2.start() ;
  10.  
  11.     var anim1 = new Thread( 20, realtime=true, target=animateBox ) ;
  12.     anim1.elid = “anim1″ ; anim1.delay = 10 ;
  13.     anim1.start() ;
  14.         
  15.     var anim2 = new Thread( 20, realtime=true, target=animateBox ) ;
  16.     anim2.elid = “anim2″ ; anim2.delay = 20 ;
  17.     anim2.start() ;
  18. }
  19.