Mark Eschbach

Software Developer && System Analyst

JavaScript in the Browser Environment

Since the late 90s JavaScript has been the defacto standard for describing beahvior within the browser. At first developers work directly against the Document Object Model until around the turn of the melenium. Then there were the DOM abstraction library wars of the early 2ks. jQuery came out on top; however jQuery provided little guidence in terms of UI architecture. With the rise of AJAX frameworks such as Backbone more state was being pushed into the browser. As HTML5 has gained a foothold and the browser environment has unfrozen, JavaScript stopped lurking in the shadows.

Abstract Execution Environment

The scripts are loaded and executed within the order specified. Initiallly the environment will execute prior to the DOM being laoded (page being parsed and represented within the environment). Most JavaScript frameworks and raw applications hook into the DOM loaded event to provide DHTML related events. The interpreter uses a reactor pattern to demultiplex events and dispatch to the registered handlers. When the user navigates away from the page, an event is fired (sometime) and the scripts are unloaded.

Notes

  • To terminate a WebWorker from within a WebWorker one calls this.close(), where this is the DedicatedWorkerGlobalScope object the script is evaulated in.