You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting-started.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ PouchDB is now installed in your app and ready to use! (In production, you shoul
53
53
The rest of the work will be done inside `app.js`. We will start by creating a database to enter your todos. To create a database simply instantiate a new PouchDB object with the name of the database:
54
54
55
55
{% highlight js %}
56
-
// EDITING STARTS HERE (you dont need to edit anything above this line)
56
+
// EDITING STARTS HERE (you don't need to edit anything above this line)
57
57
58
58
var db = new PouchDB('todos');
59
59
var remoteCouch = false;
@@ -100,7 +100,7 @@ Once you have included this code, you should be able to refresh the page to see
100
100
101
101
{% include anchor.html class="h3" title="Update the UI" hash="update_the_ui" %}
102
102
103
-
We dont want to refresh the page to see new items. More typically you would update the UI manually when you write data to it, however, in PouchDB you may be syncing data remotely, so you want to make sure you update whenever the remote data changes. To do this we will call `db.changes` which subscribes to updates to the database, wherever they come from. You can enter this code between the `remoteCouch` and `addTodo` declaration:
103
+
We don't want to refresh the page to see new items. More typically you would update the UI manually when you write data to it, however, in PouchDB you may be syncing data remotely, so you want to make sure you update whenever the remote data changes. To do this we will call `db.changes` which subscribes to updates to the database, wherever they come from. You can enter this code between the `remoteCouch` and `addTodo` declaration:
104
104
105
105
{% highlight js %}
106
106
var remoteCouch = false;
@@ -127,7 +127,7 @@ function checkboxChanged(todo, event) {
127
127
}
128
128
{% endhighlight %}
129
129
130
-
This is similar to creating a document, however the document must also contain a `_rev` field (in addition to `_id`), otherwise the write will be rejected. This ensures that you dont accidently overwrite changes to a document.
130
+
This is similar to creating a document, however the document must also contain a `_rev` field (in addition to `_id`), otherwise the write will be rejected. This ensures that you don't accidently overwrite changes to a document.
131
131
132
132
You can test that this works by checking a todo item and refreshing the page. It should stay checked.
133
133
@@ -189,7 +189,7 @@ You can check that CORS is now enabled by visiting [http://localhost:5984/_utils
189
189
Now we will have the todo list sync. Back in `app.js` we need to specify the address of the remote database. Remember to replace `user`, `pass` and `myname.example.com` with the credentials of your own CouchDB instance:
190
190
191
191
{% highlight js %}
192
-
// EDITING STARTS HERE (you dont need to edit anything above this line)
192
+
// EDITING STARTS HERE (you don't need to edit anything above this line)
193
193
194
194
var db = new PouchDB('todos');
195
195
var remoteCouch = 'http://user:pass@myname.example.com/todos';
0 commit comments