mirror of
https://github.com/pebble-dev/clay.git
synced 2026-08-27 20:36:33 -04:00
Add destroy function
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
/* eslint-disable quotes */
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
"type": "heading",
|
||||
"id": "main-heading",
|
||||
"defaultValue": "Clay Test Page",
|
||||
"size": 1
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"defaultValue": "This is config 2"
|
||||
},
|
||||
{
|
||||
"type": "section",
|
||||
"items": [
|
||||
{
|
||||
"type": "heading",
|
||||
"defaultValue": "This is a section"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"appKey": "email",
|
||||
"defaultValue": "",
|
||||
"label": "Input Field",
|
||||
"description": "This is a new field",
|
||||
"attributes": {
|
||||
"placeholder": "Placeholder set with attributes"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "submit",
|
||||
"defaultValue": "Save"
|
||||
}
|
||||
];
|
||||
@@ -16,10 +16,20 @@ module.exports = function() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
function handleButtonClick() {
|
||||
Clay.config = Clay.meta.userData.config2;
|
||||
Clay.build();
|
||||
}
|
||||
|
||||
Clay.on(Clay.EVENTS.AFTER_BUILD, function() {
|
||||
var coolStuffToggle = Clay.getItemByAppKey('cool_stuff');
|
||||
toggleBackground.call(coolStuffToggle);
|
||||
coolStuffToggle.on('change', toggleBackground);
|
||||
|
||||
Clay.getItemById('testButton').on('click', handleButtonClick);
|
||||
});
|
||||
|
||||
console.log('userData: ', Clay.meta.userData);
|
||||
|
||||
+4
-1
@@ -6,7 +6,10 @@ window.claySettings = {};
|
||||
window.customFn = require('./custom-fn.js');
|
||||
window.clayComponents = require('../src/scripts/components');
|
||||
window.clayMeta = require('../test/fixture').meta({
|
||||
userData: {foo: 'bar'}
|
||||
userData: {
|
||||
foo: 'bar',
|
||||
config2: require('./config-2')
|
||||
}
|
||||
});
|
||||
|
||||
var platform = window.navigator.userAgent.match(/Android/) ? 'android' : 'ios';
|
||||
|
||||
Reference in New Issue
Block a user