mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-10-04 15:11:41 +00:00
WIP: Add support for dependencies between startup modules
See StartupMechanism for details.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
created: 20130825142900000
|
||||
modified: 20131214093453953
|
||||
tags: mechanism
|
||||
modified: 20140502142900000
|
||||
tags: mechanism dev
|
||||
title: BootMechanism
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
@@ -39,3 +39,5 @@ In the browser, `core/boot.js` is packed into a template HTML file that contains
|
||||
On the server, `core/boot.js` is executed directly. It uses the `Node.js` local file API to load plugins directly from the file system in the `core/modules` directory. The code loading is performed synchronously for brevity (and because the system is in any case inherently blocked until plugins are loaded).
|
||||
|
||||
The boot process sets up the `$tw` global variable that is used to store all the state data of the system.
|
||||
|
||||
At the end of the boot process the StartupMechanism schedules the execution of startup modules to bring up the rest of TiddlyWiki.
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
created: 20140502142900000
|
||||
modified: 20140502142900000
|
||||
tags: mechanism dev
|
||||
title: StartupMechanism
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The startup mechanism runs the installed startup modules at the end of the [[boot process|BootMechanism]].
|
||||
|
||||
! Startup Modules
|
||||
|
||||
Modules with their ''module-type'' field set to `startup`:
|
||||
|
||||
* Must expose a `startup` function
|
||||
** For synchronous startup modules the startup function is called as `startup()`, asynchronous modules are passed a callback they must invoke on completion: `startup(callback)`
|
||||
* May expose a `name` property that is used to identify the task
|
||||
* May expose a `dependencies` property containing an array of names of dependent tasks that must be run before this one
|
||||
|
||||
! Startup Processing
|
||||
|
||||
The startup mechanism begins by sequentially executing the tasks that have no dependencies. It then continues executing tasks as they are unlocked by the completion of their dependencies.
|
||||
|
||||
There is no guarantee of the execution order of tasks that share the same dependencies.
|
||||
|
||||
! Startup Tasks
|
||||
|
||||
The core defines the following sequence of named startup tasks:
|
||||
|
||||
|!Task Name |!Description |
|
||||
Reference in New Issue
Block a user