Skip to content

Commit 96ec8cb

Browse files
author
Vlad Balin
committed
Merge branch 'f/slate-docs'
2 parents d7aea20 + 8e04280 commit 96ec8cb

File tree

125 files changed

+9911
-14020
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+9911
-14020
lines changed

README.md

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,59 @@
22

33
![master build](https://api.travis-ci.org/Volicon/Type-R.svg?branch=master)
44

5-
Type-R is the universal state container for modern JS applications written with TypeScript for both UI and domain state management.
5+
# Getting started
66

7-
API docs are here: https://volicon.github.io/Type-R/
7+
Type-R helps to declaratively define complex domain and UI application state in modern JS applications as a superposition of three kinds of building blocks:
88

9-
Distributed application state is defined as a superposition of the recursively nested `Record` and `Collection` objects.
10-
State trees support transactional and deeply observable changes and are JSON-serializable by default. All state elements are _typed_ with run-time type assertions and type conversions on assignment. The declarative attribute-level validation is supported as well.
9+
- *Record* classes with typed attributes.
10+
- Ordered *collections* of records.
11+
- *Stores* to hold collections used to resolve id-references in JSON.
1112

12-
Type-R explicitly supports both _aggregation_ and _associations by id_ with the majority of operations performed recursively on _ownership trees_.
13+
The state defined with Type-R classes is deeply observable and serializable by default. While being an advanced JSON serialization engine handling sophisticated scenarios (like cross-collections many-to-many relationships), Type-R is completely unopinionated on the client-server transport protocol.
1314

14-
10 times faster than BackboneJS in all browsers.
15+
Type-R is your perfect M and VM in MVVM and MVC architecture imposing no restrictions on V and C parts.
1516

16-
Type-R represents the pinnacle of Volicon/Verizon R&D in the state management technology lasted for 3 previous years.
17+
API docs site: https://volicon.github.io/Type-R/
1718

18-
## Rationale
19+
## Installation and requirements
1920

20-
All existing solutions for SPA state management are weird. We cannot wait when there will be the perfect one.
21+
Is packed as UMD and ES6 module. No peer dependencies are required.
22+
23+
`npm install type-r --save-dev`
24+
25+
<aside class="success">IE10+, Edge, Safari, Chrome, and Firefox are supported</aside>
26+
27+
<aside class="warning">IE9 and Opera may work but has not been tested. IE8 won't work.</aside>
28+
29+
## How the Type-R compares with X?
30+
31+
Type-R started to develop in 2014 as the modern substitution for BackboneJS, which would retain the spirit of the BackboneJS simplicity but would be superior to Ember Data in its capabilities and an order of magnitude faster than Backbone.
32+
33+
The closest things to the Type-R are [Ember Data](https://guides.emberjs.com/v2.2.0/models/), [BackboneJS models and collections](http://backbonejs.org/#Model), and [mobx](https://github.com/mobxjs/mobx).
34+
35+
There are a lot of similarities:
36+
37+
- All that things can be used to manage an application's state.
38+
- Type-R handles observable transactional changes in the way more or less similar to mobx (however, it's heavily optimized for the case of large aggregated object trees).
39+
- Type-R id-relationships and validation capabilities are comparable to ones in [Ember Data](https://guides.emberjs.com/v2.2.0/models/relationships/), which was used a source of inspiration.
40+
- Type-R has a lot of common in some API parts with BackboneJS models and collections. For instance, it uses the close API for the [collection updates](#update) and the [similar event model](#built-in-events) for the changes (however, it's generalized for the case of transactions on the nested records and collections).
41+
42+
Speaking of the distinguishing differences,
43+
44+
- Type-R's records are not key-value pairs but _classes_ with typed attributes. They are protected from improper assignment with run-time type assertions and conversions. Which means that the client-server protocol is protected again errors from both ends.
45+
- Type-R distinguishes aggregation and the plain association operating with _aggregation trees_ formed by nested records and collections. Aggregation tree is serialized as nested JSON. Operations like `clone()`, `dispose()`, `isValid()` and `toJSON()` are performed recursively on elements of aggregation tree gracefully handling the references to shared objects.
46+
- Type-R relies on _layered application state_ instead of the global singleton store. In Type-R, the stores are the special kind of records which can participate in dynamically configured lookup chains. There might be as many dynamically created and disposed stores as you need, starting with no stores at all.
47+
- Type-R features automatic lazily evaluated [validation](#validation) with declarative attribute-level rules. Validation checks are the part of the attribute type; they are evaluated in the moment they needed and never performed twice on the unchanged data.
48+
- Type-R is really fast. It's capable of handling collections of 10K elements with real-time response and is about 10 times faster than BackboneJS.
49+
50+
Feature | Type-R | Backbone Models | Ember Data | mobx
51+
-|-|-|-|-
52+
Observable changes in object graph | ✓ | - | - | ✓
53+
JSON Serialization | ✓ | ✓ | ✓ | -
54+
Validation | ✓ | ✓ | ✓ | -
55+
Dynamic Type Safety | ✓ | - | For serialization only | -
56+
Aggregation | ✓ | - | - | -
57+
Relations by id | ✓ | - | ✓ | -
2158

2259
## Roadmap
2360

docs/API_by_feature/Aggregation_tree.html

Lines changed: 0 additions & 168 deletions
This file was deleted.

0 commit comments

Comments
 (0)