Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including electron-settings with all npm packages installed. Try it out:

var electronSettings = require("electron-settings")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

electron-settings v3.2.0

A simple persistent user settings framework for Electron.

electron-settings

Npm version Npm downloads David Travis Gitter

A simple persistent user settings framework for Electron.

Originally adapted from Atom's own configuration manager and the settings manager of choice for Electron's own demo app, electron-settings allows you to persist user settings and other data simply and easily.

Also, you can subscribe to properties and get notified when their values change. So that's pretty nifty.


Install

$ npm install --save electron-settings

Demo

const { app } = require('electron');
const settings = require('electron-settings');

app.on('ready', () => {

  settings.set('name', {
    first: 'Cosmo',
    last: 'Kramer'
  });

  settings.get('name.first');
  // => "Cosmo"

  settings.has('name.middle');
  // => false
});

:warning: Please note: Any and all interaction with electron-settings must be executed after the Electron app has fired the ready event, otherwise your app may encounter unexpected errors or data loss.

Resources




Having trouble? Get help on Gitter.

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free