Skip to content

Commit 4b53d92

Browse files
authored
pebble#77 - Add docs for setSettings() (pebble#155)
1 parent fa3406a commit 4b53d92

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,8 @@ Pebble.addEventListener('webviewclosed', function(e) {
876876
| `.registerComponent( [ClayComponent] component )` <br> Registers a custom component. | `void`. |
877877
| `.generateUrl()` | `string` - The URL to open with `Pebble.openURL()` to use the Clay-generated config page. |
878878
| `.getSettings( [object] response, [boolean] convert=true)` <br> `response` - the response object provided to the "webviewclosed" event <br> `convert` - Pass `false` to not convert the settings to be compatible with `Pebble.sendAppMessage()` | `Object` - object of keys and values for each config page item with an `messageKey`, where the key is the `messageKey` and the value is the chosen value of that item. <br><br>This method will do some conversions depending on the type of the setting. Arrays will use message key array syntax to make the values of each item in the array available as individual message keys. Booleans will be converted to numbers. eg `true` becomes `1` and `false` becomes `0`. If the value is a number or an array of numbers and the optional property: "precision" is the power of precision (value * 10 ^ precision) and then floored. Eg: `1.4567` with a precision set to `3` will become `1456`. Pass `false` as the second parameter to disable this behavior. See the example below for how this all works |
879+
| `.setSettings( [string] key, [*] value )` <br> `key` - The key for the setting you want to set. <br> `value` - The value of the setting you want to set. | `void` |
880+
| `.setSettings( [object] settings )` <br> `settings` - An object of key/value pairs that you would like to update the settings with. eg `{ user_name: 'Emily', show_animations: true }` | `void` |
879881

880882
#### `.getSettings()` Example
881883

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,12 @@ Clay.prototype.getSettings = function(response, convert) {
217217
* Updates the settings with the given value(s).
218218
*
219219
* @signature `clay.setSettings(key, value)`
220-
* @param {String} key the property to set.
221-
* @param {String} value the value assigned to _key_.
220+
* @param {String} key - The property to set.
221+
* @param {*} value - the value assigned to _key_.
222222
* @return {undefined}
223223
*
224-
* @signature `clay.setSettings(setting)`
225-
* @param {Object} setting an object containing the key/value pairs to be set.
224+
* @signature `clay.setSettings(settings)`
225+
* @param {Object} settings - an object containing the key/value pairs to be set.
226226
* @return {undefined}
227227
*/
228228
Clay.prototype.setSettings = function(key, value) {

0 commit comments

Comments
 (0)