From 2eba37bdb18ea469c5def44269b31e72ea6f6c32 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 24 Apr 2019 20:55:15 -0700 Subject: [PATCH] RxJS always returns a Subscription object with an unsubscribe. Co-Authored-By: benlesh --- src/internal/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/internal/utils.js b/src/internal/utils.js index ea3f2ddde5..f773be639d 100644 --- a/src/internal/utils.js +++ b/src/internal/utils.js @@ -50,7 +50,7 @@ export function validate_store(store, name) { export function subscribe(component, store, callback) { let unsub = store.subscribe(callback); // Prevent memory leaks for RxJS users. - if (typeof unsub === 'object' && typeof unsub.unsubscribe === 'function') { + if (unsub.unsubscribe) { unsub = () => unsub.unsubscribe(); } component.$$.on_destroy.push(unsub);