Skip to content

Instantly share code, notes, and snippets.

@Unknown025
Created October 11, 2020 20:43
Show Gist options
  • Save Unknown025/f84208eef17ea6e2389fb943b3697eaf to your computer and use it in GitHub Desktop.
Save Unknown025/f84208eef17ea6e2389fb943b3697eaf to your computer and use it in GitHub Desktop.
Test usage of the electron-json-storage library in Electron with React.
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