Here's is an example of panel label content defining 2 fields and a function.
var toReturn = {}; toReturn.field1='Hello'; toReturn.field2='World!'; toReturn.doSomething = function(){return (this.field1 + ' ' + this.field2);}; toReturn; // eval returns the evaluation of last statement which is the object you to return. See Mozilla documentation.
// Now, use the thing. var evaluated = eval(CF.widget(tags to get to panel above).label); System.print(evaluated.toSource();); System.print(evaluated.doSomething());
Note that you can assign null to evaluated variable and all evaluated stuff is cleaned up.