refactor: tidy use of Set for store subscribers

There's no need to check that a Set has an element before trying to
remove it.
pull/6563/head
Conduitry 3 years ago
parent b2260bc2e3
commit d487254beb

@ -97,9 +97,7 @@ export function writable<T>(value?: T, start: StartStopNotifier<T> = noop): Writ
run(value);
return () => {
if (subscribers.has(subscriber)) {
subscribers.delete(subscriber);
}
subscribers.delete(subscriber);
if (subscribers.size === 0) {
stop();
stop = null;

Loading…
Cancel
Save