Skip to content

Commit

Permalink
Add plugin settings usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
BrainMaestro committed Apr 12, 2017
1 parent 71d732a commit 3c7a5ac
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/plugins/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,33 @@ module.exports = {
fn: plugin
};
```

### using `settings`
```js
const plugin = ({ display, settings }) => {
const icon = require('[path-to-icon]/icon.png');

display({
icon: settings.icon ? icon : '',
title: `${settings.username}, you have been around for ${settings.age}`,
subtitle: `Favorite languages: ${settings.languages.join(',')}`,
})
}

module.exports = {
fn: plugin,
settings: {
username: { type: 'string' },
age: { type: 'number', defaultValue: 42 },
icon: { type: 'bool' },
languages: {
type: 'option',
description: 'Your favorite programming languages'
options: ['JavaScript', 'Haskell', 'Rust'],
multi: true,
createable: true,
}
}
}

```

0 comments on commit 3c7a5ac

Please sign in to comment.