# electron-auto-setting

Latest version **2.1.1** (published 2018-07-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install electron-auto-setting
pnpm add electron-auto-setting
yarn add electron-auto-setting
bun add electron-auto-setting
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2018-07-14 |
| First published | 2018-05-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 823 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | miyogurt |

## Links

- npm: https://www.npmjs.com/package/electron-auto-setting
- npm.io page: https://npm.io/package/electron-auto-setting

## Dependencies (6)

- [at-ui](https://npm.io/package/at-ui.md) ^1.3.3
- [debug](https://npm.io/package/debug.md) ^3.1.0
- [at-ui-style](https://npm.io/package/at-ui-style.md) ^1.5.1
- [feather-icons](https://npm.io/package/feather-icons.md) ^4.7.3
- [electron-store](https://npm.io/package/electron-store.md) ^1.3.0
- [source-map-support](https://npm.io/package/source-map-support.md) ^0.5.6

## Recent versions

- 2.1.1 (latest) — 2018-07-14
- 2.1.0 — 2018-07-14
- 2.0.0 — 2018-06-07
- 1.1.1 — 2018-05-26
- 1.1.0 — 2018-05-26
- 1.0.0 — 2018-05-26

## README

# electron-auto-setting

<img src="./screen.png" width="1920" />

## How to Use?

```js
import create, { init, store } from 'electron-auto-setting'
const { app, Menu, Tray } = require('electron')
const { resolve } = require('path')

let setting = [
  {
    icon: 'icon-settings',
    label: '设置',
    configs: {
      gender: {
        type: 'choice',
        label: '性别',
        choices: ['male', 'female'],
        defaultValue: 'male'
      },
      path: {
        type: 'path',
        label: '保存路径',
        defaultValue: __dirname
      },
      output: {
        type: 'boolean',
        label: '是否保存',
        defaultValue: true
      }
    }
  },
  {
    icon: 'icon-airplay',
    label: '电脑',
    configs: {
      API_KEY: {
        type: 'string',
        label: 'API_KEY',
        defaultValue: 'xxxx'
      },
    }
  }
]

let win = null
let tray = null

init(setting)

openSetting = () => {
  win = create()
  store.onDidChange('gender', console.log)
  console.log(store.store)
}

app.on('ready', () => {
  tray = new Tray(resolve(__dirname, 'icon.png'))
  const contextMenu = Menu.buildFromTemplate([
    { label: 'setting', click: openSetting }
  ])
  tray.setToolTip('This is my application.')
  tray.setContextMenu(contextMenu)
})

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit()
  }
})
```

## icon

https://at-ui.github.io/at-ui/#/zh/docs/icon

## Type

* choice
* path
* boolean
* string

---
_Source: https://npm.io/package/electron-auto-setting · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
