Skip to content

Latest commit

 

History

History
45 lines (25 loc) · 3.73 KB

application.md

File metadata and controls

45 lines (25 loc) · 3.73 KB

Application

Application layer is mainly responsible for:

📖 Refer to architecture.md | Layered Application to read more about the layered architecture.

Structure

Application layer code exists in /src/application and includes following structure:

  • collections/: Holds collection files.
  • Common/: Contains common functionality in application layer.
  • ...: rest of the application layer source code organized using folders-by-feature structure.

Application state

It uses state pattern with context and state objects. ApplicationContext.ts the "Context" of state pattern provides an instance of CategoryCollectionState.ts (the "State" of the state pattern) for every supported collection.

Presentation layer uses a singleton (same instance of) ApplicationContext.ts throughout the application to ensure consistent state.

📖 Refer to architecture.md | Application State to get an overview of event handling and presentation.md | Application State for deeper look into how the presentation layer manages state.

Application data

Application data is collection files using YAML. You can refer to collection-files.md to read more about the scheme and structure of application data files. You can also check the source code collection yaml files to directly see the application data using that scheme.

Application layer parses and compiles application data into Application). Once parsed, application layer provides the necessary functionality to presentation layer based on the application data. You can read more about how presentation layer consumes the application data in presentation.md | Application Data.

Application layer enables data-driven programming by leveraging the data to the rest of the source code. It makes it easy for community to contribute on the project by using a declarative language used in collection files.

Parsing and compiling

Application layer parses the application data to compile the domain object Application.ts.

A webpack loader loads (or injects) application data (collection yaml files) into the application layer in compile time. Application layer (ApplicationFactory.ts) parses and compiles this data in runtime.

Application layer compiles templating syntax during parsing to create the end scripts. You can read more about templating syntax in templating.md and how application data uses them through functions in collection-files.md | Function.

The steps to extend the templating syntax:

  1. Add a new parser under SyntaxParsers where you can look at other parsers to understand more.
  2. Register your in CompositeExpressionParser.