btford / btford/react-palm

Feat/Doc: Cancelling tasks, subscriptions

Open
#23 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
60
Forks
7
PR merge metrics
No merged PRs in 30d

Description

I gotta think about this a bit.

- Subscriptions are sometimes a better model. But "subscriptions" aren't intuitive for discrete tasks.
- Cancellation implies eagerness. Tasks are lazy. You can't cancel something that hasn't happened.
- You want to get a cancellable object back after dispatching the task.
- Task -> Execution (cancellable) -> Result
- Most of the time, you want the execution to be transparent.

```
task = xhr "google.com"
execution <- do task

// one of:
status <- cancel execution
result <- execution
```

but also:

```
task = xhr "google.com"
result <- do task
```

Prefer an API that's monomorphic– we don't actually want to overload `do task`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.