Skip to content

Instantly share code, notes, and snippets.

@DmytroVasin
Created March 11, 2018 16:46
Show Gist options
  • Save DmytroVasin/7e7e4eb5f7d211eb335c6e7c5624d55b to your computer and use it in GitHub Desktop.
Save DmytroVasin/7e7e4eb5f7d211eb335c6e7c5624d55b to your computer and use it in GitHub Desktop.
PouchDB
https://github.com/gtaranas/forecaster/blob/47707dcbfd7c23acedbd7428ae35a8696aaa8c49/src/renderer/datastore.js
https://codepen.io/lonekorean/pen/xGLLwX?editors=1100
import PouchDB from 'pouchdb-browser'
import path from 'path'
import { remote } from 'electron'
const db = new PouchDB(path.join(remote.app.getPath('userData'), '/data.db'))
async function init () {
let forecasterDb = await db.get('forecaster').catch(err => {
console.log(err)
return db.put({
_id: 'forecaster',
teams: []
})
})
console.log(forecasterDb.teams)
}
export {
db,
init
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment