Skip to content

Commit 84693f9

Browse files
docs(website): add initial documentation
1 parent 1f17f67 commit 84693f9

25 files changed

+21550
-60
lines changed

package-lock.json

Lines changed: 21108 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 78 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,83 @@
11
# Action
22

3-
hihi
3+
```marksy
4+
<Example name="api_action" />
5+
```
46

7+
An action allows you to compose pieces of logic into an execution. You typically execute an action based on some user interaction in your application, but it could be everything from a route change to a websocket message as well.
58

6-
## Map
7-
Some operator code
9+
Actions are defined with a powerful chaining API which gives control of the execution itself. The asynchronocity of your execution is completely abstracted away, you only think about the logical order of execution and Overmind takes care of the rest.
810

9-
## Do
10-
Some more operator code
11+
The action is built up by **operators**, methods called on the action itself. These operators describes the execution logic.
12+
13+
## debounce
14+
```marksy
15+
<Example name="api_action_debounce" />
16+
```
17+
18+
Typically used to only continue execution of the last action call if multiple action calls has been made in the time limit passed in.
19+
20+
The only argument is the time limit in milliseconds the operator should prevent action calls to continue. When the an action call has waited for the milliseconds defined, without any new action calls has been made, the execution will continue.
21+
22+
## do
23+
```marksy
24+
<Example name="api_action_do" />
25+
```
26+
27+
Typically used to fire off an effect without caring about its returned result, if any.
28+
29+
Only argument is a function that receives the **effects** registered in the application as the first argument, and the current **value** of the action as the second argument. Any returned value will be ignored. The current value of the action will be passed to the next operator.
30+
31+
## filter
32+
```marksy
33+
<Example name="api_action_filter" />
34+
```
35+
36+
Typically used to stop execution related to some condition.
37+
38+
The first argument is a function that receives the **effects** registered in the application as the first argument, and the current **value** as the second argument. If the function returns the value `false`, synchronously or asynchronously, the execution of the action will stop.
39+
40+
## fork
41+
```marksy
42+
<Example name="api_action_fork" />
43+
```
44+
Typically used to fork out execution when a value can result in multiple complex executions.
45+
46+
The first argument is a function that receives the **effects** as the first argument and the current **value** as the second. The function is expected to return a value, either synchronously or asynchronously, that matches the paths passed as the second argument to the fork operator.
47+
48+
49+
## map
50+
```marksy
51+
<Example name="api_action_map" />
52+
```
53+
54+
Typically used to get values from an effect or transform the current value of the action.
55+
56+
Only argument is a function that receives the **effects** registered in the application as the first argument, and the current **value** of the action as the second argument. The returned value will become the new value of the action.
57+
58+
## mutation
59+
```marksy
60+
<Example name="api_action_mutation" />
61+
```
62+
63+
Used to change the state of the application.
64+
65+
Only argument is a function that receives the **state** as the first argument and the current **value** of the action as the second argument. This operator is the only operator that is allowed to mutate the state of the application.
66+
67+
## try
68+
```marksy
69+
<Example name="api_action_try" />
70+
```
71+
72+
Typically used to explicitly handle potentially thrown errors from an effect.
73+
74+
The first argument is a function that receives the **effects** registered in the application as the first argument, and the current **value** as the second argument. The second argument to the operator are two paths, **success** and **error** which are respectively executed based on the success of the first argument function.
75+
76+
## when
77+
```marksy
78+
<Example name="api_action_when" />
79+
```
80+
81+
Typically used to fork execution based on a thruthy or falsy value.
82+
83+
The first argument is a function that receives the **effects** registered in the application as the first argument, and the current **value** as the second argument. The second argument to the operator are two paths, **true** and **false** which are respectively executed based on the thruthyness of the returned value in the first argument function, which can be synchronous or asynchronous.
Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
# App
22

33
```marksy
4-
<Code
5-
js={
6-
`
7-
const foo = "bar"
8-
`
9-
}
10-
ts={
11-
`
12-
const foo: string = "bar"
13-
`
14-
}
15-
/>
16-
```
4+
<Example name="api_app_initialize" view />
5+
```
6+
7+
The **App** class is used to create the application instance. The instance itself exposes a **connect** function used to connect views to the state of the application and allow them to trigger actions.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Compute
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Connect
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Derive
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Effects
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Namespaced
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Reaction
100 KB
Binary file not shown.

0 commit comments

Comments
 (0)