Define a schema under a config
key in your plugin main.
module.exports = {
config: {
someStr: {
title: 'host',
description: 'plantuml server',
type: 'string',
default: 'localhost'
},
enableThing: {
title: 'enable thing',
type: 'boolean',
default: false
},
thingVolume: {
title: 'thing volume',
type: 'integer',
default: 5,
minimum: 1,
maximum: 11
}
},
activate () {
// ...
}
}
inkdrop.config.get('my-package.myKey') # -> 'defaultValue'
inkdrop.config.set('my-package.myKey', 'value')
inkdrop.config.get('my-package.myKey') # -> 'value'
You may want to watch for changes. Use ::observe to catch changes to the setting.
inkdrop.config.set('my-package.myKey', 'value')
inkdrop.config.observe('my-package.myKey', (newValue) => {
// `observe` calls immediately and every time the value is changed
console.log('My configuration changed:', newValue)
})