Kozmos' client-side database for keeping bookmarks offline in the browser using indexeddb. It syncs with Kozmos servers when user is online.
$ yarn add kozmos/likedb
Initialize using your personal API key & secret:
import likedb from 'likedb'
const db = likedb({
apiKey: '',
apiSecret: '',
host: '',
postIntervalSecs: 1.5, // Post updates -if there are any- every 1.5 seconds
pushIntervalSecs: 60, // Check for updates every 60 seconds
onPostUpdates: () => console.info('Kozmos just posted some updates to server'),
onReceiveUpdates: () => console.info('Kozmos just received some updates from server')
onError: (error, action) => console.info('Failed during %s: %s', error.action, error)
})
Add a page to likes:
db.likes.like('github.com', err => console.error(err))
Delete a page from your likes:
db.likes.unlike('github.com', err => console.error(err))
Check if a page is liked:
db.likes.get('github.com', (error, doc) => {
error
// => undefined
doc
// => undefined
})
This library is based on Kaktüs Web Browser's database library. Although it only stores bookmarks, in the future kaktüs' meta store and its builtin keyword search will be useful for implementing offline search.