https://github.com/dy/sube
Subscribe to any reactive source, weakly
https://github.com/dy/sube
Last synced: 3 months ago
JSON representation
Subscribe to any reactive source, weakly
- Host: GitHub
- URL: https://github.com/dy/sube
- Owner: dy
- Created: 2022-01-14T03:14:32.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-01-08T01:46:13.000Z (over 2 years ago)
- Last Synced: 2025-09-12T21:16:09.901Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 57.6 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
> Subscribe weakly to any reactive source
```js
import sub from './sube.js'
unsub = sub(source, onnext, onerror?, oncomplete?)
unsub() // unsubscribe
```
Kinds of sources:
* _Promise_, _Thenable_ (autocleanup)
* _Observable_, _Subscribable_, _Subject_ ([rxjs](https://ghub.io/rxjs), [zen-observable](https://github.com/zenparsing/zen-observable) etc.)
* _AsyncIterable_ (see [it-awesome](https://github.com/alanshaw/it-awesome))
* _Signal_ ([@preact/signals](https://ghub.io/@preact/signals), [value-ref](https://ghub.io/value-ref) etc.)
* _observ-\*_ ([observ](https://www.npmjs.com/package/observ), [observable](https://www.npmjs.com/package/observable), [mutant](https://www.npmjs.com/package/mutant))
🕉