Skip to content

Instantly share code, notes, and snippets.

@AhmedTarekHasan
Last active October 19, 2021 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AhmedTarekHasan/b1173d1e32568101445f3036a2786199 to your computer and use it in GitHub Desktop.
Save AhmedTarekHasan/b1173d1e32568101445f3036a2786199 to your computer and use it in GitHub Desktop.
.
.
.
let subscribersStateChangeNotificationCallback = (subscriberFound) => {
if(!subscriberFound && isNowWatching) {
stopWatching();
isNowWatching = false;
} else if(subscriberFound && !isNowWatching) {
startWatching();
}
};
self.data = new Subject(subscribersStateChangeNotificationCallback);
.
.
.
self.data.next(self.snapshot.data);
.
.
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment