Skip to content

Commit 8d67729

Browse files
author
Patryk Lesiewicz
committed
Code snippet indentation.
1 parent 72fb635 commit 8d67729

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

firestore-counter/POSTINSTALL.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,39 +37,39 @@ gcloud scheduler jobs create http firestore-sharded-counter-controller --schedul
3737

3838
1. Use the Counter SDK library in your code to increment counters. The code snippet below is just an example, for more comprehensive API documentation, please refer to the [source code](https://dev-partners.googlesource.com/samples/firebase/mods/+/master/firestore-sharded-counter/clients/web/src/index.ts):
3939

40-
```html
41-
<html>
42-
<head>
43-
<script src="https://www.gstatic.com/firebasejs/[version]/firebase-app.js"></script>
44-
<script src="https://www.gstatic.com/firebasejs/[version]/firebase-firestore.js"></script>
45-
<script src="sharded-counter.js"></script>
46-
</head>
47-
<body>
48-
<script>
49-
// Initialize Firebase.
50-
var firebaseConfig = { projectId: "${PROJECT_ID}" };
51-
firebase.initializeApp(firebaseConfig);
52-
var db = firebase.firestore();
53-
54-
// Initialize the sharded counter.
55-
var visits = new sharded.Counter(db.doc("pages/hello-world"), "stats.visits");
56-
57-
// Increment the field "stats.visits" of the document "pages/hello-world".
58-
visits.incrementBy(1);
59-
60-
// Listen to locally consistent values.
61-
visits.onSnapshot((snap) => {
62-
console.log("Locally consistent view of visits: " + snap.data());
63-
});
64-
65-
// Alternatively, if you don't mind counter delays, you can listen to the document directly.
66-
db.doc("pages/hello-world").onSnapshot((snap) => {
67-
console.log("Eventually consistent view of visits: " + snap.get("stats.visits"));
68-
});
69-
</script>
70-
</body>
71-
</html>
72-
```
40+
```html
41+
<html>
42+
<head>
43+
<script src="https://www.gstatic.com/firebasejs/[version]/firebase-app.js"></script>
44+
<script src="https://www.gstatic.com/firebasejs/[version]/firebase-firestore.js"></script>
45+
<script src="sharded-counter.js"></script>
46+
</head>
47+
<body>
48+
<script>
49+
// Initialize Firebase.
50+
var firebaseConfig = { projectId: "${PROJECT_ID}" };
51+
firebase.initializeApp(firebaseConfig);
52+
var db = firebase.firestore();
53+
54+
// Initialize the sharded counter.
55+
var visits = new sharded.Counter(db.doc("pages/hello-world"), "stats.visits");
56+
57+
// Increment the field "stats.visits" of the document "pages/hello-world".
58+
visits.incrementBy(1);
59+
60+
// Listen to locally consistent values.
61+
visits.onSnapshot((snap) => {
62+
console.log("Locally consistent view of visits: " + snap.data());
63+
});
64+
65+
// Alternatively, if you don't mind counter delays, you can listen to the document directly.
66+
db.doc("pages/hello-world").onSnapshot((snap) => {
67+
console.log("Eventually consistent view of visits: " + snap.get("stats.visits"));
68+
});
69+
</script>
70+
</body>
71+
</html>
72+
```
7373

7474
### Using the extension
7575

0 commit comments

Comments
 (0)