2012-04-30 11:23:03 +00:00
|
|
|
/*\
|
2012-05-03 20:47:16 +00:00
|
|
|
title: $:/core/bootprefix.js
|
2012-04-30 11:23:03 +00:00
|
|
|
type: application/javascript
|
|
|
|
|
|
|
|
This file sets up the globals that need to be available when JavaScript modules are executed in the browser. The overall sequence is:
|
|
|
|
|
|
|
|
# BootPrefix.js
|
|
|
|
# <module definitions>
|
|
|
|
# Boot.js
|
|
|
|
|
|
|
|
See Boot.js for further details of the boot process.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Set up $tw global for the browser
|
|
|
|
if(window && !window.$tw) {
|
2012-05-19 10:29:51 +00:00
|
|
|
window.$tw = {browser: {}};
|
2012-04-30 11:23:03 +00:00
|
|
|
}
|
|
|
|
|
2012-04-30 18:14:39 +00:00
|
|
|
$tw.modules = {titles: {}}; // hashmap by module name of {fn:, exports:, moduleType:}
|
2012-04-30 11:23:03 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
Define a JavaScript tiddler module for later execution
|
|
|
|
moduleName: name of module being defined
|
|
|
|
moduleType: type of module
|
|
|
|
fn: function defining the module, called with the arguments (module,require,exports)
|
|
|
|
*/
|
2012-04-30 18:14:39 +00:00
|
|
|
$tw.modules.define = function(moduleName,moduleType,fn) {
|
|
|
|
$tw.modules.titles[moduleName] = {
|
2012-04-30 11:23:03 +00:00
|
|
|
moduleType: moduleType,
|
|
|
|
fn: fn
|
|
|
|
};
|
|
|
|
};
|
2012-10-12 18:01:03 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
Define a tiddler
|
|
|
|
*/
|
|
|
|
$tw.preloadTiddlers = $tw.preloadTiddlers || [];
|
|
|
|
|
|
|
|
$tw.preloadTiddler = function(fields) {
|
|
|
|
$tw.preloadTiddlers.push(fields);
|
|
|
|
};
|
|
|
|
|