Home

# Class goog.module.Loader

The dynamic loading functionality is defined as a class. The class will be used as singleton. There is, however, a two step initialization procedure because parameters need to be passed to the goog.module.Loader instance.

Instance Method Summary
| `getModuleUrl_(string urlBase, string module) ⇒ string` Creates a full URL to the compiled module code given a base URL and a module name. By default it's urlBase + '_' + module + '.js'.
| `init(string baseUrl, ?Function= opt_urlFunction)` Initializes the Loader to be fully functional. Also executes load requests that were received before initialization. Must be called exactly once, with the URL of the base library. Module URLs are derived from the URL of the base library by inserting the module name, preceded by a period, before the .js prefix of the base URL.
| `load_(string module)` Starts to load a module. Assumes that init() was called.
| `provide(string module, number= opt_symbol, ?Object= opt_object)` Registers a symbol in a loaded module. When called without symbol, registers the module to be fully loaded and executes all callbacks from pending require() callbacks for this module.
| `require(string module, number symbol, ?Function callback)` Requests the loading of a symbol from a module. When the module is loaded, the requested symbol will be passed as argument to the function callback.

Static Method Summary

`loaderEval_(string t_)`

Loads the module by evaluating the javascript text in the current scope. Uncompiled, base identifiers are visible in the global scope; when compiled they are visible in the closure of the anonymous namespace. Notice that this cannot be replaced by the global eval, because the global eval isn't in the scope of the anonymous namespace function that the jscompiled code lives in.