Shim for old-style Dojo code
Use legacy client-side libraries in node.js environment without dragging around the entire Dojo toolkit.
The set of Dojo facilities provided is extremely minimalistic and targets the requirements of specific libraries.
Usage
var dojo = require( "dojo-shim-node" );
dojo.registerPrefix( "my_dojo_lib", module );
dojo.require( "my_dojo_lib.my_dojo_module" );
var my_dojo_lib = dojo.global.my_dojo_lib;
my_dojo_lib.my_dojo_module.my_dojo_function();
The exported object is dojo
namespace itself with one additional function, registerPrefix
. Other namespaces
can be accessed via dojo.global
. To import legacy Dojo-based libraries, use dojo.require()
.
dojo.registerPrefix()
function registerPrefix( prefix, path_or_module )
First argument prefix
is Dojo namespace prefix consisting of one or more identifiers separated with dots. Second
argument path_or_module
could be either an absolute path to the top level directory corresponding to the prefix or
a Node.js module
object. In the latter case, the library will look for a tree of nested directories described by
prefix
relative to the location of module.filename
.