()
| 378 | |
| 379 | //fetch and update visitor count with firestore |
| 380 | function fetchVisitorCount() { |
| 381 | firebase |
| 382 | .firestore() |
| 383 | .collection("general") |
| 384 | .doc("count") |
| 385 | .get() |
| 386 | .then((doc) => { |
| 387 | $("#visitors").text(doc.data().count); |
| 388 | }) |
| 389 | .catch((error) => { |
| 390 | $("#visitors").text(error).css("color", "#EA3546"); |
| 391 | }); |
| 392 | } |
| 393 | if (localStorage.getItem("count") == null) { |
| 394 | firebase |
| 395 | .firestore() |