hoodiehq / pouchdb-hoodie-api

:dog: Hoodie-like API for PouchDB
https://hoodiehq.github.io/pouchdb-hoodie-api
Apache License 2.0
44 stars 11 forks source link

add debounce option #111

Open gr2m opened 8 years ago

gr2m commented 8 years ago

follow up for https://github.com/hoodiehq/hoodie/issues/202

Use case: continuously saving a text entered by a user with every key stroke. Instead of creating thousands of revisions, we want to store the current text in memory for a short time and only save after the user stopped typing for a moment (e.g. 2 seconds).

Suggested API

hoodie.store.add('doc', properties, {debounce: true})

or set a custom timeout in ms

hoodie.store.add('doc', properties, {debounce: 5000})