Extracto de [[Dojo and Spidermokey|http://www.bluishcoder.co.nz/2006/05/dojo-and-spidermonkey.html]]
----
//Dojo has a 'profile' system that allows you to create a customised 'dojo.js' which contains Dojo packages that you want preloaded. Anything not preloaded will be loaded automatically when required by the package system. One file that is needed by Dojo is 'hostenv' which needs to be tailored for a specific Javascript implementation. There is a hostenv_browser for web browsers, hotenv_spidermonkey for spidermonkey, hostenv_rhino, etc.
To set up a customised dojo.js, which does nothing but makes it specific for Spidermonkey, I created a 'buildscripts/profiles/spidermonkey.profile.js' file with the following contents://
{{{
var hostenvType="spidermonkey";
var dependencies=[];
load("getDependencyList.js");
}}}
//This is exactly the same as the 'minimal.profile.js' but with the hostenvType set to 'spidermonkey'. Once this is done a customised dojo.js system for Spidermonkey can be created with the following Ant command://
{{{
cd buildscripts
ant -Dprofile=spidermonkey -Ddocless=true release intern-strings
}}}
//The custom Dojo build for Spidermonkey is created at 'release/dojo'. You can test it with Spidermonkey with something like (user input in red)://
{{{
cd release/dojo
js
js> load("dojo.js");
js> dojo.version
0.2.2+ (3802)
}}}
//Many of Dojo's libraries are usable from Spidermonkey, including the package system and events. Here's an example demonstrating a usage of Dojo events from Spidermonkey://
{{{
cd release/dojo
js
js> load("dojo.js");
js> dojo.require("dojo.event.*");
js> var scheme = {}
js> scheme.jit = false
false
js> scheme.setJit = function(value) { this.jit = value }
js> var monitor = {}
js> monitor.watchJit = function() { print("Jit: " + scheme.jit) }
js> dojo.event.connect(scheme,"setJit",monitor,"watchJit")
[object Object]
js> scheme.setJit(true)
Jit: true
js> scheme.setJit(false)
Jit: false
}}}
----
Continua..