This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
var handlebars = require("handlebars")
var qs = require('querystring');
global.jCache={};
exports.endpoint = function(request, response) {
var Params = qs.parse(request.url.split('?')[1]||"");
for(var p in Params ){
if( !Params[p] ){
delete global.jCache[p];
continue;
}
global.jCache[p] = Params[p];
}
response.write(
handlebars
.compile(""
+"{{#*inline 'Test'}}In {{.}}{{/inline}}"
+"{{#*inline 'Params'}}{{#each .}}\n{{@key}}{{/each}}{{/inline}}"
+"{{#*inline 'Cache'}}{{#each .}}\n{{@key}}:{{.}}{{/each}}{{/inline}}"
+"TEST:{{#with t}}{{>Test}}{{/with}}"
+"\n\nCache:\n{{>Cache cache}}"
+"\n\nParams:\n{{>Params params}}"
)
( {
"t":"Handlebars"
,"params":Params
,"cache":global.jCache
} )
);
response.end(
handlebars
.compile("{{#*inline 'Test'}}{{.}}!{{/inline}}\nHello {{#with t}}{{>Test}}{{/with}}"
+"\n\nRunKit, did I mention, thanks! This is pretty kool!")
( {"t":"World"} )
);
}