Created
March 11, 2018 16:46
-
-
Save DmytroVasin/7e7e4eb5f7d211eb335c6e7c5624d55b to your computer and use it in GitHub Desktop.
PouchDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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