mirror of
https://github.com/pebble-dev/clay.git
synced 2026-08-27 20:36:33 -04:00
Refactor structure to be more testable
This commit is contained in:
+4
-4
@@ -22,7 +22,7 @@ module.exports = [
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"app_key": "email",
|
||||
"appKey": "email",
|
||||
"value": "",
|
||||
"label": "Email",
|
||||
"attributes": {
|
||||
@@ -34,13 +34,13 @@ module.exports = [
|
||||
},
|
||||
{
|
||||
"type": "toggle",
|
||||
"app_key": "like_stuff",
|
||||
"appKey": "cool_stuff",
|
||||
"label": "Enable Cool Stuff",
|
||||
"value": false
|
||||
},
|
||||
{
|
||||
"type": "color",
|
||||
"app_key": "background",
|
||||
"appKey": "background",
|
||||
"value": "0xFF0000",
|
||||
"label": "Background Color"
|
||||
}
|
||||
@@ -56,7 +56,7 @@ module.exports = [
|
||||
{
|
||||
"id": "flavor",
|
||||
"type": "select",
|
||||
"app_key": "flavor",
|
||||
"appKey": "flavor",
|
||||
"value": "grape",
|
||||
"label": "Favorite Flavor",
|
||||
"options": [
|
||||
|
||||
+9
-9
@@ -1,15 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function() {
|
||||
var Api = window.Clay = this;
|
||||
var Clay = this;
|
||||
|
||||
var testHandler = function() {
|
||||
console.debug('KEEGAN: this', this);
|
||||
console.debug('KEEGAN: arguments', arguments);
|
||||
// Api.getItemByAppKey('background').off(testHandler);
|
||||
};
|
||||
Clay.getItemByAppKey('cool_stuff').on('change', function() {
|
||||
if (this.get()) {
|
||||
Clay.getItemByAppKey('background').enable();
|
||||
} else {
|
||||
Clay.getItemByAppKey('background').disable();
|
||||
}
|
||||
});
|
||||
|
||||
Api.getItemByAppKey('background').on('change', testHandler);
|
||||
|
||||
console.debug('custom fn worked');
|
||||
Clay.getSettings();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user