var scriptElt = document.createElement('script');
scriptElt.type = 'text/javascript';
scriptElt.src = 'https://s3.amazonaws.com/s3.mathisonian.com/javascripts/requirify-browser.js';
scriptElt.onload = function(){
require('esprima', 'esprima')
var afterEscodegenLoaded = function afterEscodegenLoaded(){
function plus(x,y){
// let's parse and reverse-parse this function here
// note how this comment here will be removed
return x+y;
}
document.body.textContent = 'everything loaded';
var abstract_syntax_tree = esprima.parse(plus.toString());
var regenerated = escodegen.generate(abstract_syntax_tree);
var preElt = document.createElement('pre')
preElt.textContent = regenerated;
document.body.appendChild(preElt);
}
var checkEscodegenLoaded = function checkEscodegenLoaded(){
var T = document.body.textContent;
var type = typeof escodegen;
if (type==='object'){
afterEscodegenLoaded();
} else {
document.body.textContent = T + '*';
window.setTimeout(checkEscodegenLoaded, 4000);
}
}
var afterEsprimaLoaded = function afterEsprimaLoaded(){
document.body.textContent = 'loaded esprima - standby while escodegen is loaded';
require('escodegen', 'escodegen');
checkEscodegenLoaded();
}
var checkEsprimaLoaded = function checkEsprimaLoaded(){
var type = typeof esprima;
if (type==='object'){
afterEsprimaLoaded();
} else {
window.setTimeout(checkEsprimaLoaded, 4000);
}
}
document.body.textContent = 'standy, loading esprima...'
checkEsprimaLoaded();
}
document.head.appendChild(scriptElt);
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!