Comparing version 0.3.0 to 0.3.1
{ | ||
"name": "tinysaga", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "module": "esm/index.js", |
@@ -62,2 +62,4 @@ [![](https://img.shields.io/circleci/build/github/crazytoucan/tinysaga)](https://app.circleci.com/pipelines/github/crazytoucan/tinysaga?branch=master) | ||
This snippet shows how multiple action types can be combined to implement complex behavior. Here we use `lodash.debounce()` for most of the heavy lifting. | ||
```ts | ||
@@ -86,1 +88,27 @@ const DismissPopover = defineAction("DismissPopover"); | ||
``` | ||
For comparison, equivalent Redux-Saga code is something like: | ||
```ts | ||
const DismissPopover = defineAction("DismissPopover"); | ||
const PopoverAnchorEnter = defineAction("PopoverAnchorEnter"); | ||
const PopoverEnter = defineAction("PopoverEnter"); | ||
function popoverSaga() { | ||
yield fork(function* () { | ||
while (true) { | ||
yield takeLatest(DismissPopover.TYPE, function* () { | ||
const { pass } = yield race({ | ||
anchorEnter: take(PopoverAnchorEnter.TYPE), | ||
enter: take(PopoverEnter.TYPE), | ||
pass: delay(500), | ||
}); | ||
if (pass) { | ||
yield put(DismissPopoverInternal()); // goes off to a reducer somewhere | ||
} | ||
}; | ||
} | ||
}); | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15038
113