You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/overmind-website/api/action.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,15 @@ Actions are defined with a powerful chaining API which gives control of the exec
10
10
11
11
The action is built up by **operators**, methods called on the action itself. These operators describes the execution logic.
12
12
13
+
## attempt
14
+
```marksy
15
+
h(Example, { name: "api/action_try" })
16
+
```
17
+
18
+
Typically used to explicitly handle potentially thrown errors from an effect.
19
+
20
+
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.
21
+
13
22
## compose
14
23
```marksy
15
24
h(Example, { name: "api/action_compose" })
@@ -26,15 +35,6 @@ Typically used to only continue execution of the last action call if multiple ac
26
35
27
36
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.
28
37
29
-
## do
30
-
```marksy
31
-
h(Example, { name: "api/action_do" })
32
-
```
33
-
34
-
Typically used to fire off an effect without caring about its returned result, if any.
35
-
36
-
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, though you can return a promise to indicate that the do operator needs to be resolved. The current value of the action will be passed to the next operator.
37
-
38
38
## filter
39
39
```marksy
40
40
h(Example, { name: "api/action_filter" })
@@ -52,6 +52,15 @@ Typically used to fork out execution when a value can result in multiple complex
52
52
53
53
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.
54
54
55
+
## run
56
+
```marksy
57
+
h(Example, { name: "api/action_do" })
58
+
```
59
+
60
+
Typically used to fire off an effect without caring about its returned result, if any.
61
+
62
+
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, though you can return a promise to indicate that the do operator needs to be resolved. The current value of the action will be passed to the next operator.
63
+
55
64
56
65
## map
57
66
```marksy
@@ -80,15 +89,6 @@ Typically used to run multiple composed actions in parallel. "In parallel" means
80
89
81
90
The parallel operator does not return a value.
82
91
83
-
## try
84
-
```marksy
85
-
h(Example, { name: "api/action_try" })
86
-
```
87
-
88
-
Typically used to explicitly handle potentially thrown errors from an effect.
89
-
90
-
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.
0 commit comments