Appframe Knowledge Base


1 hits
0

JavaScript Conventions - Article Script

// Now support importing of templates or other scripts like this:
"import /static/template/af.common.templates.someTemplate.js";

// Standard function scope. Not really necessary when debugging.
(function(scope,undef){
	var w = scope.window, $ = w.jQuery,
		vAny, vVariables, vYou, vMight, vNeed;

	function anyCommonFunctions(pYouMightNeed) {
		return "somethingUseful";
	}

	$("div.someClass").append(c.runTemplate(af.common.templates.someTemplate, {
		TemplateField: "someValue",
		OtherField: 12345
	}, {
		CustomField: function(pData) {
			return pData.TemplateField + pData.OtherField;
		}
	}));

	// Remember to include some comments for non-obvious things

}(this));

components web · Perma link post comment Posted by: Jan Henrik Høiland Meling (08-mar-2012)