0.0.1 • Published 7 years ago
electron-preference v0.0.1
electron-preference
This module offers App-Preference functions and screen on your Electron Application easily!
##Installation
$ npm install electron-preference
##How to use
###Pre-requirements
You need make a JSON-defined column into your electron-application project folder.
For example:
[
{
"name":"Tab1",
"items":[
{
"name":"checkbox1",
"text":"checkbox1",
"description":"Please check if you are lucky!",
"type":"checkbox",
"default":"true"
},
{
"name":"text1",
"text": "first name",
"description":"Your First Name",
"type": "text",
"default":"takuya"
},
{
"name":"text2",
"text":"last name",
"description":"Your Last Name",
"type": "text",
"default":"takahashi"
}]
},{
"name":"Tab2",
"items":[
{
"name":"birthday",
"type":"date",
"default":"1992-12-20"
}
]
}
]
Only text, checkbox, date are supported so far.
Then, you need write this code on your main.js
.
const preference = require('electron-preference');
preference.load('path/to/preference.json');
###Display preference
Only you need is writing this code.
preference.show();
The shortcut Cmd+,
is good practice to use Preference with MacOS.
Finally, this window will appear.
###Getting preference data
You can access preference data with this code.
preference.get(function(data){
// type your code
});
You will get this Object
:
{
"Tab1":{
"checkbox1":true,
"text1":"takuya",
"text2":"takahashi"
},
"Tab2":{
"birthday":"1992/12/20"
}
}
##Thanks
I used this theme! THANK YOU!
https://github.com/VinceG/Bootstrap-Admin-Theme-3
##License
MIT
0.0.1
7 years ago