Comments (1)
If you use the start
event, you can do that :
const source$ = new Observable(o => setInterval(o.next, 1000))
// Will unsubscribe after first event has been emitted
source$.subscribe({
start(sub) {this.sub = sub},
next(i) => {
console.log(i * 2);
this.sub.unsubscribe();
}
})
from es-observable.
Related Issues (20)
- Invalid test based on Interface. HOT 1
- `obs.subscribe(next, error, complete)` should bind their callbacks to `undefined` when present HOT 5
- Why does `Observable.prototype.subscribe` report thrown errors from `observer.start(sub)` asynchronously instead of just propagating them?
- Minor spec bug WRT cleanup in `subscribe`
- `Observable.from` iteration functions incorrectly assume their observer parameter is native HOT 1
- [ALTERNATIVE] Proposal for an alternative
- Cleanup function should be passed to the SubscriptionObserver
- Simplification of Observable API HOT 69
- Even simpler API HOT 4
- Reduced API with async/await support HOT 23
- Observable should be async HOT 5
- Syntax Support HOT 4
- Alternative: Pub/Sub
- Moving to an API with AbortSignal HOT 9
- Retain core API and leave operators to user-land libraries HOT 15
- Permit unsubscribe to return a promise HOT 3
- Is there any update? HOT 34
- Support [Symbol.dispose]() for unsubscribe() HOT 1
- Unsubscribe
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from es-observable.