Merge pull request #94 from pebble/#66/update-readme

Add JS settings to getting started
This commit is contained in:
keegan-lillo
2016-06-09 09:01:27 -07:00
+8 -6
View File
@@ -21,28 +21,30 @@ Clay will eventually be built into the Pebble SDK. However, while it is still in
var clay = new Clay(clayConfig);
```
6. Add `configurable` to the `capabilities` array in your `appinfo.json`.
7. Next is the fun part - creating your config page. Edit your `config.js` file to build a layout of elements as described in the sections below.
7. Ensure `enableMultiJS` is set to true in your `appinfo.json`.
8. Next is the fun part - creating your config page. Edit your `config.js` file to build a layout of elements as described in the sections below.
# Getting Started (CloudPebble)
Clay will eventually be built into CloudPebble. However while it is still in beta, you will need to follow some steps.
NOTE these are similar to using the SDK but instead of a data file called config.json, a javascript file config.js is required.
1. Create a new JavaScript file called `clay.js`.
2. Copy the contents from the **clay.js** distribution file found in the [latest release](https://github.com/pebble/clay/releases/latest) into your newly created `clay.js` file.
3. Create another JavaScript file called `config.js` with the following content. This will act as your config's root array element, from which the rest of the page is built up:
1. Ensure `JS Handling` is set to `CommonJS-style` in your project settings.
2. Create a new JavaScript file called `clay.js`.
3. Copy the contents from the **clay.js** distribution file found in the [latest release](https://github.com/pebble/clay/releases/latest) into your newly created `clay.js` file.
4. Create another JavaScript file called `config.js` with the following content. This will act as your config's root array element, from which the rest of the page is built up:
```javascript
module.exports = [];
```
4. Your `app.js` file needs to `require` clay and your config file, then be initialized. Clay will by default automatically handle the 'showConfiguration' and 'webviewclosed' events. Copy and paste the following into the top of your `app.js` file:
5. Your `app.js` file needs to `require` clay and your config file, then be initialized. Clay will by default automatically handle the 'showConfiguration' and 'webviewclosed' events. Copy and paste the following into the top of your `app.js` file:
```javascript
var Clay = require('clay');
var clayConfig = require('config');
var clay = new Clay(clayConfig);
```
5. Next is the fun part - creating your config page. Edit your `config.js` file to build a layout of elements as described in the sections below.
6. Next is the fun part - creating your config page. Edit your `config.js` file to build a layout of elements as described in the sections below.
# Creating Your Config File