Expose Clay version

This commit is contained in:
Keegan
2016-06-14 21:59:10 -07:00
parent 2f9e36bdb2
commit 9e344d527b
3 changed files with 14 additions and 1 deletions
+4 -1
View File
@@ -864,6 +864,8 @@ function cssColor(color) {
cssColor(Settings.option('BACKGROUND_COLOR') || 0xff0000); cssColor(Settings.option('BACKGROUND_COLOR') || 0xff0000);
``` ```
## Clay API (app.js)
### `Clay([Array] config, [function] customFn, [object] options)` ### `Clay([Array] config, [function] customFn, [object] options)`
#### Constructor Parameters #### Constructor Parameters
@@ -887,6 +889,7 @@ cssColor(Settings.option('BACKGROUND_COLOR') || 0xff0000);
| `.meta.accountToken` | String | A unique account token that is associated with the Pebble account of the current user. Read more [here](https://developer.pebble.com/docs/js/Pebble/#getAccountToken). | | `.meta.accountToken` | String | A unique account token that is associated with the Pebble account of the current user. Read more [here](https://developer.pebble.com/docs/js/Pebble/#getAccountToken). |
| `.meta.watchToken` | String | A unique token that can be used to identify a Pebble device. Read more [here](https://developer.pebble.com/docs/js/Pebble/#getWatchToken). | | `.meta.watchToken` | String | A unique token that can be used to identify a Pebble device. Read more [here](https://developer.pebble.com/docs/js/Pebble/#getWatchToken). |
| `.meta.userData` | Any | A deep copy of the arbitrary data provided in the `options.userData`. Defaults to an empty object | | `.meta.userData` | Any | A deep copy of the arbitrary data provided in the `options.userData`. Defaults to an empty object |
| `.version` | String | The version of Clay currently being used. |
#### Methods #### Methods
@@ -962,7 +965,7 @@ module.exports = function(minified) {
}; };
``` ```
## Clay API ## Clay API (Custom Function)
### `ClayConfig([Object] settings, [Array] config, [$Minified] $rootContainer)` ### `ClayConfig([Object] settings, [Array] config, [$Minified] $rootContainer)`
+2
View File
@@ -4,6 +4,7 @@ var configPageHtml = require('./tmp/config-page.html');
var toSource = require('tosource'); var toSource = require('tosource');
var standardComponents = require('./src/scripts/components'); var standardComponents = require('./src/scripts/components');
var deepcopy = require('deepcopy/build/deepcopy.min'); var deepcopy = require('deepcopy/build/deepcopy.min');
var version = require('./package.json').version;
/** /**
* @param {Array} config - the Clay config * @param {Array} config - the Clay config
@@ -38,6 +39,7 @@ function Clay(config, customFn, options) {
watchToken: '', watchToken: '',
userData: {} userData: {}
}; };
self.version = version;
/** /**
* Populate the meta with data from the Pebble object. Make sure to run this inside * Populate the meta with data from the Pebble object. Make sure to run this inside
+8
View File
@@ -121,6 +121,14 @@ describe('Clay', function() {
}); });
}); });
describe('.version', function() {
it('has the correct version', function() {
var config = fixture.config(['input', 'text', 'color']);
var clay = fixture.clay(config);
assert.strictEqual(clay.version, require('../../package.json').version);
});
});
describe('.config', function() { describe('.config', function() {
it('is a copy not a reference', function() { it('is a copy not a reference', function() {
var config = fixture.config(['input', 'text', 'color']); var config = fixture.config(['input', 'text', 'color']);