Skip to content

Instantly share code, notes, and snippets.

@thenoseman
Created October 9, 2015 19:09
Show Gist options
  • Save thenoseman/ed8068c4e480d4c59719 to your computer and use it in GitHub Desktop.
Save thenoseman/ed8068c4e480d4c59719 to your computer and use it in GitHub Desktop.
TeardownContent function in FoF
var rules = [{
// This demonstrates:
// - usage of setupContent
// - usage of context.storage in setupContent/teardownContent/value function
// - the fact that all three functions have the same context available
"url": /20-teardown-content/,
"name": "Teardown content function",
"setupContent": function() {
context.storage.set("setBySetupContent", "setBySetupContent");
},
"teardownContent": function() {
jQuery("#target").val(context.storage.get("setBySetupContent"));
jQuery("#target2").val(context.storage.get("setByValueFunction"));
jQuery("#target3").val("set by teardownContent");
},
"fields": [{
"selector": "input",
"value": function($e, data) {
context.storage.set("setByValueFunction", "setByValueFunction");
return "filled by field def";
}
}]
}
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment