twoBirds Lib 2.0 Released

Written by on April 2nd, 2007 in Ajax News.

twoBirds Lib 2.0, a library that handles on-demand loading problems, has been released by Frank Thuerigen.

It works asynchronous and allows out-of-order execution of JS code. JS objects can recursively load other JS objects.

Take a look at the prototype to see it in action:

In the “user” field top right enter a character combination and hit return to enter… in the menu click on “communication” and then “chat”… enjoy your chat. A closer look using firebug etc. will reveal that all element parts are loaded separately, simultaneously and out-of-order, on-demand when you click on a link.
The system itself ensures that elements are being displayed once all the necessary files have loaded. Note: IE users may have to add this site to the list of trusted sites, since login requires a cookie. All demo windows are accessible without login.
There is no more loading after the first display of an element, all data and code was cached and on re-selection displayed right away causing no server traffic. The chat will periodically retrieve new lines, of course…

Example Code

JAVASCRIPT:

  1.  
  2.  application.index_body = {
  3.  
  4.    init: function (pDivId) {
  5.    tb.element.require(
  6.    “[ [ ‘css’, ‘application’, ‘index_body’ ], ” +
  7.    ” [ ‘tpl’, ‘application’, ‘index_body’ ], ” +
  8.    ” [ ‘js’, ‘tb’, ‘effect.fadeTo’ ] ]”,
  9.    ‘application.index_body.display( “‘ + pDivId + ‘” )’ ,
  10.    true
  11.    );
  12.    },
  13.  
  14.    display: function (pDivId) {
  15.    var myHtml = tb.loader.tplget(’application’,’index_body’);
  16.    tb.div.replace( pDivId, myHtml );
  17.    tb.element.require(
  18.    “[ [ ‘js’, ‘application’, ‘menu’ ], ” +
  19.    ” [ ‘css’, ‘application’, ‘menu’ ], ” +
  20.    ” [ ‘tpl’, ‘application’, ‘menu’ ], ” +
  21.    ” [ ‘js’, ‘application’, ‘user_greeting’ ], ” +
  22.    ” [ ‘css’, ‘application’, ‘user_greeting’ ], ” +
  23.    ” [ ‘tpl’, ‘application’, ‘user_greeting’ ], ” +
  24.    ” [ ‘js’, ‘application’, ’submenu’ ], ” +
  25.    ” [ ‘css’, ‘application’, ’submenu’ ], ” +
  26.    ” [ ‘tpl’, ‘application’, ’submenu’ ], ” +
  27.    ” [ ‘js’, ‘application’, ‘window’ ], ” +
  28.    ” [ ‘css’, ‘application’, ‘window’ ], ” +
  29.    ” [ ‘tpl’, ‘application’, ‘window’ ] ]”
  30.    );
  31.    tb.element.show( ‘toprightcontainer’ , ‘application’, ‘user_login’ );
  32.    }
  33.    };

Source: Ajaxian
Original Article: http://ajaxian.com/archives/twobirds-lib-20-released

Leave a Reply

You must be logged in to post a comment.



Site Navigation