Merge branch 'rxjs-support' of https://github.com/benlesh/svelte into benlesh-rxjs-support

pull/2577/head
Richard Harris 6 years ago
commit c4a8e9755f

@ -48,7 +48,12 @@ export function validate_store(store, name) {
} }
export function subscribe(component, store, callback) { export function subscribe(component, store, callback) {
component.$$.on_destroy.push(store.subscribe(callback)); let unsub = store.subscribe(callback);
// Prevent memory leaks for RxJS users.
if (unsub.unsubscribe) {
unsub = () => unsub.unsubscribe();
}
component.$$.on_destroy.push(unsub);
} }
export function create_slot(definition, ctx, fn) { export function create_slot(definition, ctx, fn) {

Loading…
Cancel
Save