Prevent error entirely

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
pull/8186/head
Ben Bucksch 4 years ago committed by GitHub
parent d14efa3760
commit ef7e2fc450
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -99,11 +99,8 @@ export function writable<T>(value?: T, start: StartStopNotifier<T> = noop): Writ
return () => { return () => {
subscribers.delete(subscriber); subscribers.delete(subscriber);
if (subscribers.size === 0) { if (subscribers.size === 0) {
if (stop === null) {
throw new Error('unsubscribe cannot be called twice');
}
stop(); stop();
stop = null; stop = noop;
} }
}; };
} }

Loading…
Cancel
Save