increment = {
let unsubscribe;
let doc = await app.firestore().collection("observable-counter").doc("counter");
(function subscribe() {
unsubscribe = doc.onSnapshot(doc => {
mutable count = doc.data().count
});
})();
invalidation.then(() => {
unsubscribe();
});
return () => { doc.update({ count: firebase.firestore.FieldValue.increment(1) }) };
}