Skip to content

Commit

Permalink
Add settings docs
Browse files Browse the repository at this point in the history
  • Loading branch information
BrainMaestro committed Apr 12, 2017
1 parent 7314aca commit 7e7ea14
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/plugins/plugin-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This plugin will write to console all changes in your search field of Cerebro ap
* `copyToClipboard``Function(text: String)`, copy text to clipboard;
* `replaceTerm``Function(text: String)`, replace text in main Cerebro input;
* `hideWindow``Function()`, hide main Cerebro window.
* `settings` - `Object`, contains user provided values of all specified settings keys;


Let's show something in results list:
Expand Down Expand Up @@ -149,3 +150,21 @@ Arguments: `message: Object` – object that you sent from `initializeAsync`
Use this function to receive data back from your `initializeAsync` function.

Check `initializeAsync` and `onMessage` [example](./examples.md#using-initializeasync-and-onmessage)

### `settings`
Type: `Object`

This object is used to specify settings that a plugin user can change. Each setting should include a `description` and a `type`. Other keys include:
* `label` - `String`, object key for the setting. also used to access it;
* `description` - `String`, description of the setting;
* `type` - `String`, used to decide element for rendering a setting:
* `string`
* `number`
* `bool`
* `option`
* `defaultValue` - `Any`, default value for the setting;
* `options` - `Array`, all possible options that can be selected by the user. applicable only for `option`;
* `multi` - `Bool`, allows user to select more than one option for `option` settings;
* `createable` - `Bool`, allows user created options;

Look at [React Select](https://github.com/JedWatson/react-select) for more details on how the `option` type works.

0 comments on commit 7e7ea14

Please sign in to comment.