-
Notifications
You must be signed in to change notification settings - Fork 71
JS Architecture
The Framework driving the user agent is Flight, which is "a lightweight, component-based JavaScript framework that maps behavior to DOM nodes". Flight is in itself pretty lightweight in the sense that it isn't very opinionated, except for separation of concerns:
Flight enforces strict separation of concerns. When you create a component you don't get a handle to it. Consequently, components cannot be referenced by other components and cannot become properties of the global object tree. This is by design. Components do not engage each other directly; instead, they broadcast their actions as events which are subscribed to by other components.
It only uses DOM Events to communicate among components. The justification for that, the separation of concerns if pretty debatable, because you have the very same dependencies, only that you convert compile-time dependencies into runtime-dependencies, so that claim can be easily dismissed. Instead, it seems to be a rather cheap workaround for the lacking dependency injection.
Flight itself seems to be pretty much abandoned.
The code is mostly structured along
- Features (separated into Data Access Objects and UI)
- Dispatchers (bootstrapping UI initialization)
- Mixins (containing shared functionality used among different components)
- Sandbox scripts (loaded in the iFrame sandbox)
- Monkey Patches
The JS is authored using AMD, which is being concatenated, compiled and minified at build time.
Testing is done w/ Jasmine as test runner and matcher framework. The test structure is similar to the code.