-
Notifications
You must be signed in to change notification settings - Fork 189
Architecture
padolsey edited this page Jun 27, 2012
·
1 revision
Here we outline the structure and terminology of bonsaiJS.
- Bootstrapper: The general name given to the code that initiates the RendererController and the RunnerContext, enabling them to communicate.
-
Player: The exposed API on the parent page. It will initiate the RendererController, which will, in turn, initiate the relevant
RunnerContext
(iframe or worker). - RunnerContext: The context where the runner runs. The RunnerContext creates this context. This is either an iframe or a worker.
- [part of RunnerContext] RunnerContext creator: Creates the context. E.g. creates an
<iframe>
. - [part of RunnerContext] RunnerContext bootstrap: Initiating logic within context. Provides way to load files/scripts/sub-movies within the context.
- RendererController: Initiates and controls the RunnerContext and the Renderer.
- Renderer: The actual renderer. E.g. the SVG renderer.
- Runner: The actual runner, i.e. the bonsai stage and the bonsai API. The runner is what runs the actual movie file(s).
- [Name needs to be decided -- it's currently confusing]
- This file is loaded in the parent page and within the context (iframe/window)
- It provides IF branches for dealing with each of those environments. In the parent env it sets up the player and requests RunnerContext-creation script (in dev mode). In the context env it requires the relevant RunnerContext bootstrap file and runs it.
- Must provide
init
anddestroy
methods - Must provide
load
method (acceptingurl
parameter for loading movie/plugin scripts): This method should fire aloadScript
message to the accompanying bootstrap. - Must provide
run
method (acceptingcode
parameter for running inline movie/plugin code): This method should fire arunScript
message to the accompanying bootstrap.
- Initiates [but does not instantiate] the RunnerContext
- Responsible for passing messages between the renderer and the runner context. It acts as a proxy between:
AssetController <-> Renderer
RunnerContext <-> Renderer
- Module must be a function: called by
_dev/_build iframe/worker
- Must instantiate a Stage
- Must provide
stageInstance.loadSubMovie
- Must listen for and process
runScript
message - Must listen for and process
loadScript
message [synchronous -- order is relevant]
bonsai/
src/
asset/ (asset loaders/handlers used between Runner and Renderer)
bootstrapper/ (files related to bootstrapping, i.e. context creators/bootstrap)
renderer/ (files related to the renderers)
svg/
runner/ (the actual runner -- Bonsai API)
* (misc. files used in more than one place)