User talk:Gerbrant/fw.js
From Wikipedia, the free encyclopedia
- Gerbrant.fw
- Since this is the actual module loader, it cannot be loaded using the id above.
- Usage:
document.write('<script type="text/javascript" src="http://en.wikipedia.org/w/index.php?title=User:Gerbrant/fw.js&action=raw&ctype=text/javascript&dontcountme=s"></script>');
[edit] Exports
- module(moduleName, moduleObject)
- Called by a module that exports stuff. moduleName is the full id of a module, moduleObject is the object that contains all the exported stuff.
module("user.someModule", new function() { ... };
– or, when a module is dependent on another module –
... loadModule("user.otherModule", function() { ... module("user.someModule", obj); }; ...
- loadModule(moduleName, callback)
- Loads the module identified by moduleName. If the module cotains a module-call, the callback will be called when the module is ready to be used.
- Syntax: myCallbackFunction(moduleObject, moduleName)
- Note that both arguments supplied to the callback are just a convenience and not really necessary.
- loadModules([moduleName, ...], callback)
- Load multiple modules.
- version
- The version of this module as a string.
- revision
- The revision number – will be incremented every time something changes.
[edit] Settings
- load
- An array of full id's (names) of modules to load when this script is included. Modules loaded this way are guaranteed to have the functions exported by this module available.
Gerbrant = {fw: {load: [ "user.someScript", ... ]}}