Electron-Settings:快速开发你的设置界面

发表于 4年以前  · 总阅读数:3015 次

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.

 1个收藏

 1个关注

访问GitHub主页
 目录