- refactor array equality check and add tests - remove OperatingSystem.Unknown causing extra logic, return undefined instead - refactor enum validation to share same logic - refactor scripting language factories to share same logic - refactor too many args in runCodeAsync - refactor ScriptCode constructor to reduce complexity - fix writing useless write to member object since another property write always override it
2.9 KiB
2.9 KiB
Application
- It's mainly responsible for
- creating and event based application state
- parsing and compiling application data
- Consumed by presentation layer
Structure
/src/application/: Contains all application related code.collections/: Holds collection filesCommon/: Contains common functionality that is shared in application layer...: other classes are categorized using folders-by-feature structure
Application state
- ApplicationContext.ts holds the CategoryCollectionState for each OS
- Uses state pattern
- Same instance is shared throughout the application to ensure consistent state
- 📖 See Application State | Presentation layer to read more about how the state should be managed by the presentation layer.
- 📖 See ApplicationContext.ts to start diving into the state code.
Application data
- Compiled to
Applicationdomain object. - The scripts are defined and controlled in different data files per OS
- Enables data-driven programming and easier contributions
- Application data is defined in collection files and
- 📖 See Application data | Presentation layer to read how the application data is read by the presentation layer.
- 📖 See collection files documentation to read more about how the data files are structured/defined and see collection yaml files to directly check the code.
Parsing
- Application data is parsed to domain object
Application.ts - Steps
- (Compile time) Load application data from collection yaml files using webpack loader
- (Runtime) Parse and compile application and make it available to presentation layer by
ApplicationFactory.ts
Compiling
- Parsing the application files includes compiling scripts using collection file defined functions
- To extend the syntax:
- Add a new parser under SyntaxParsers where you can look at other parsers to understand more.
- Register your in CompositeExpressionParser