A paradigm shift for Javascript
The best bit of J you'll find today.
The richest vein of J ever found
TITLE for Video: Un-blocking Javascript. - Putting the Asynchronous into AJAX, a way bring (emulate) multiple threads into Javascript
Emulating
[video here]
Solving two problems with one tool.
A brand new Design Pattern especailly for JavaScript
The Inversion of Control possible with the Require & Repeat pattern, can change the way you code.
Javascript suffers from some unique problems because it is a remotely loaded and single threaded.
http://www.artzstudio.com/2008/07/beating-blocking-javascript-asynchronous-js/
http://blog.jeffhaynie.us/cross-browser-way-to-dynamically-load-javascript.html
http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/
http://www.mozilla.org/js/language/js20-1999-03-25/execution-model.html
http://www.artzstudio.com/2008/07/optimizing-web-performance-with-aol-pagetest/
Script loading is syncronus and blocking. Each script is loaded and evaluated in turn, and blocks everything else until it is finished.
The creation of AJAX(Asyncronus JavaScript And XML) as an idea, or remote data loading,
brought the ability to load data outside the application thread, and this meant a better user experience.
In fact, this idea is responcible for most of the Rich Internet Application available on the WWW today..
However, the promise of AJAX, is far more than just asyncronus data loading
Most javascript is simply loaded with the page
finally , javascript has a real loader
by taking the loading and running of scripts out of the page timeline, the page can load faster and the your scripts can run better.
Non-blocking scripts have an inherant problem with dependancy => RORE
running Out of sequence (ie: loading sequence specified) needs a way to handle dependancies
However, the asyncronus nature of dynamically loaded scripts could cause a race condition if a second script loads before the first is finished,
and then runs, expecting a function from the first to be available. This is where our new design pattern "require or repeat" RequiRe / RORE
It allows us to check that a required condition has been met, and if it fails to postpone the function and call it again, when it can check again.
Loader brings a few very simple but extremely powerful functions:
<script src="jlode.loader.js"></script><script>
// this is the simple way, this will speed up your page
// it allows you to load both CSS & JS asyncronusly
// ie: outside your normal page timeline
include("path/to/your/script.js");
include("path/to/your/style.css");function test(){
// Require or Repeat
//
the advanced way to real asyncronus scripts
// make sure you put the script requirements on one line
require("path/to/your/script.js","path/to/your/otherscript.js");
// now check a function is available
require(Name.Space.myfunction);
// now use the boolean returned from a function
require(JLODE.isDOMLoaded());
// now you can do what you want, in the certainty that all requirements are met
.....
e.g.: call you code that need the DOM to be fully loaded
}
// now wrap test function in a repeat
test = test.makeRepeatable(1000) ;
//now call the function
test();
</script>
Download and Sign up to our Newsletter here,
or
I am freeloading leech, I want to take your download and give you nothing
I believe that I am entitled to take your work without give you anything is return
I also have no interest in becoming a better programmer with your new techniques...
Who write this aweful code? Who built this trash? Who designed this horrible stuff?
P.S.: This work is all copyrighted, use it by all means, but the rights belongs to us.