Skip to content

Commit

Permalink
Add plugins settings usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
BrainMaestro committed Apr 12, 2017
1 parent 7e7ea14 commit 3771947
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 3771947

Please sign in to comment.