Add destroy function

This commit is contained in:
Keegan
2016-05-26 18:45:22 -07:00
parent b553094742
commit 70bb2e9d07
5 changed files with 150 additions and 7 deletions
+38
View File
@@ -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"
}
];
+10
View File
@@ -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
View File
@@ -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';