-
-
Save Unknown025/f84208eef17ea6e2389fb943b3697eaf to your computer and use it in GitHub Desktop.
Test usage of the electron-json-storage library in Electron with React.
This file contains 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
import React from "react"; | |
const electron = window.require('electron').remote; | |
const storage = electron.require('electron-json-storage'); | |
export default function Component() { | |
storage.get('config', (err, data) => { | |
if (err) | |
throw err; | |
console.log('Loaded config:') | |
console.log(data); | |
data.testVal = false; | |
console.log('Edited config:') | |
console.log(data); | |
storage.set('config', data, (err) => { | |
if (err) | |
throw err; | |
}); | |
}); | |
return ( | |
<p></p> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment