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
@@ -57,7 +56,8 @@ an abort signal was there without sacrificing any clarity in achieving it.
57
56
58
57
## Action Constructor
59
58
60
-
The [`action()`][action] function provides a callback based API to create Effection operations. You don't need it all that often, but when you do it functions almost exactly like the
59
+
The [`action()`][action] function provides a callback based API to create Effection operations.
60
+
You don't need it all that often, but when you do it functions almost exactly like the
61
61
[promise constructor][promise-constructor]. To see this, let's
62
62
use [one of the examples from MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/Promise#examples)
63
63
that uses promises to make a crude replica of the global [`fetch()`][fetch]
@@ -89,7 +89,7 @@ function* fetch(url) {
89
89
xhr.onload= () =>resolve(xhr.responseText);
90
90
xhr.onerror= () =>reject(xhr.statusText);
91
91
xhr.send();
92
-
return () => { }// "finally" function place holder.
92
+
return () => {};// "finally" function place holder.
93
93
});
94
94
}
95
95
```
@@ -108,11 +108,11 @@ until _both_ requests are have received a response.
108
108
```js
109
109
awaitPromise.race([
110
110
fetch("https://openweathermap.org"),
111
-
fetch("https://open-meteo.org")
112
-
])
111
+
fetch("https://open-meteo.org"),
112
+
]);
113
113
```
114
114
115
-
With Effection, this is easily fixed by calling `abort()` in the finally function to
115
+
With Effection, this is easily fixed by calling `abort()` in the finally function to
116
116
make sure that the request is cancelled when it is either resolved, rejected, or
117
117
passes out of scope.
118
118
@@ -124,15 +124,16 @@ function* fetch(url) {
124
124
xhr.onload= () =>resolve(xhr.responseText);
125
125
xhr.onerror= () =>reject(xhr.statusText);
126
126
xhr.send();
127
-
return () => { xhr.abort(); }; // called in all cases
127
+
return () => {
128
+
xhr.abort();
129
+
}; // called in all cases
128
130
});
129
131
}
130
132
```
131
133
132
-
>💡Almost every usage of the [promise concurrency primitives][promise-concurrency]
134
+
>💡Almost every usage of the [promise concurrency primitives][promise-concurrency]
0 commit comments