Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cygnusroboticus/concurrency-light
Lightweight concurrency management, heavily inspired by ember-concurrency.
https://github.com/cygnusroboticus/concurrency-light
concurrency
Last synced: about 2 months ago
JSON representation
Lightweight concurrency management, heavily inspired by ember-concurrency.
- Host: GitHub
- URL: https://github.com/cygnusroboticus/concurrency-light
- Owner: CygnusRoboticus
- License: mit
- Created: 2019-06-29T21:51:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T22:35:02.000Z (almost 2 years ago)
- Last Synced: 2024-10-02T15:19:14.507Z (3 months ago)
- Topics: concurrency
- Language: TypeScript
- Homepage:
- Size: 880 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# concurrency-light
Lightweight concurrency management, heavily inspired by [ember-concurrency](https://github.com/machty/ember-concurrency).
## Installation
- `yarn add concurrency-light`
- `npm install --save concurrency-light`## Usage
```typescript
import { task, TaskStrategy, timeout } from "concurrency-light";class DocClass {
constructor() {
this.asyncSearch("pants");
this.asyncSearch.isRunning; // true
this.asyncSearch("skirts"); // restarted
}@task({ strategy: TaskStrategy.Restart })
*asyncSearch(search: string) {
yield timeout(500);
yield fetch(`/api/search?filter[query]=${search}`);
}
}
```