mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-10-31 15:42:59 +00:00 
			
		
		
		
	More refactoring of startup.js
This commit is contained in:
		| @@ -1,5 +1,5 @@ | ||||
| /*\ | ||||
| title: $:/core/modules/startup/process-commands.js | ||||
| title: $:/core/modules/startup/commands.js | ||||
| type: application/javascript | ||||
| module-type: startup | ||||
| 
 | ||||
| @@ -13,9 +13,9 @@ Command processing | ||||
| "use strict"; | ||||
| 
 | ||||
| // Export name and synchronous status
 | ||||
| exports.name = "process-commands"; | ||||
| exports.name = "commands"; | ||||
| exports.platforms = ["node"]; | ||||
| exports.after = ["setup-story"]; | ||||
| exports.after = ["story"]; | ||||
| exports.synchronous = false; | ||||
| 
 | ||||
| exports.startup = function(callback) { | ||||
| @@ -1,5 +1,5 @@ | ||||
| /*\ | ||||
| title: $:/core/modules/startup/main-render.js | ||||
| title: $:/core/modules/startup/render.js | ||||
| type: application/javascript | ||||
| module-type: startup | ||||
| 
 | ||||
| @@ -13,9 +13,9 @@ Main stylesheet and page rendering | ||||
| "use strict"; | ||||
| 
 | ||||
| // Export name and synchronous status
 | ||||
| exports.name = "main-render"; | ||||
| exports.name = "render"; | ||||
| exports.platforms = ["browser"]; | ||||
| exports.after = ["rootwidget"]; | ||||
| exports.after = ["story"]; | ||||
| exports.synchronous = true; | ||||
| 
 | ||||
| // Time (in ms) that we defer refreshing changes to draft tiddlers
 | ||||
| @@ -3,7 +3,7 @@ title: $:/core/modules/startup/rootwidget.js | ||||
| type: application/javascript | ||||
| module-type: startup | ||||
|  | ||||
| Setup the root widget | ||||
| Setup the root widget and the core root widget handlers | ||||
|  | ||||
| \*/ | ||||
| (function(){ | ||||
| @@ -15,7 +15,7 @@ Setup the root widget | ||||
| // Export name and synchronous status | ||||
| exports.name = "rootwidget"; | ||||
| exports.platforms = ["browser"]; | ||||
| exports.after = ["setup-story"]; | ||||
| exports.before = ["story"]; | ||||
| exports.synchronous = true; | ||||
|  | ||||
| var widget = require("$:/core/modules/widgets/widget.js"); | ||||
| @@ -44,10 +44,6 @@ exports.startup = function() { | ||||
| 	$tw.rootWidget.addEventListener("tw-scroll",function(event) { | ||||
| 		$tw.pageScroller.handleEvent(event); | ||||
| 	}); | ||||
| 	// Listen for the tw-home message | ||||
| 	$tw.rootWidget.addEventListener("tw-home",function(event) { | ||||
| 		displayDefaultTiddlers(); | ||||
| 	}); | ||||
| 	// Install the save action handlers | ||||
| 	$tw.rootWidget.addEventListener("tw-save-wiki",function(event) { | ||||
| 		$tw.syncer.saveWiki({ | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /*\ | ||||
| title: $:/core/modules/startup/setup-story.js | ||||
| title: $:/core/modules/startup/story.js | ||||
| type: application/javascript | ||||
| module-type: startup | ||||
| 
 | ||||
| @@ -13,7 +13,7 @@ Load core modules | ||||
| "use strict"; | ||||
| 
 | ||||
| // Export name and synchronous status
 | ||||
| exports.name = "setup-story"; | ||||
| exports.name = "story"; | ||||
| exports.after = ["startup"]; | ||||
| exports.synchronous = true; | ||||
| 
 | ||||
| @@ -41,6 +41,12 @@ exports.startup = function() { | ||||
| 				openStartupTiddlers({defaultToCurrentStory: true}); | ||||
| 			} | ||||
| 		},false) | ||||
| 		// Listen for the tw-home message
 | ||||
| 		$tw.rootWidget.addEventListener("tw-home",function(event) { | ||||
| 			var storyFilter = $tw.wiki.getTiddlerText(DEFAULT_TIDDLERS_TITLE), | ||||
| 				storyList = $tw.wiki.filterTiddlers(storyFilter); | ||||
| 			$tw.wiki.addTiddler({title: DEFAULT_STORY_TITLE, text: "", list: storyList},$tw.wiki.getModificationFields()); | ||||
| 		}); | ||||
| 	} | ||||
| }; | ||||
| 
 | ||||
		Reference in New Issue
	
	Block a user
	 Jermolene
					Jermolene