diff scripttags.js @ 104:648659961e0e

Get editor working again
author Mike Pavone <pavone@retrodev.com>
date Thu, 11 Apr 2013 00:12:21 -0700
parents 4d87c38404d6
children da7f585bf626
line wrap: on
line diff
--- a/scripttags.js	Thu Aug 09 19:26:21 2012 -0700
+++ b/scripttags.js	Thu Apr 11 00:12:21 2013 -0700
@@ -2,8 +2,12 @@
 function compileAndRun(src)
 {
 	var ast = parser.parse(src);
-	var js = ast.toJSModule();
-	mainModule = eval(js)();
+	asyncProcessTopLevelJS(toplevel, function() {
+		var js = makeJSProg(ast);
+		eval(js);
+	});
+	/*.toJSModule();
+	mainModule = eval(js);
 	if (mainModule.strue) {
 		each(mainModule.strue, function(key, val) {
 			if(val instanceof Function) {
@@ -13,18 +17,21 @@
 			}
 		});
 	}
-	mainModule.main();
+	mainModule.main();*/
 }
 
 onReady(function() {
-	var tags = qall('script[type="text/tabletprog"]');
-	for (var i = 0; i < tags.length; ++i) {
-		if (tags[i].src) {
-			get(tags[i].src, function(req) {
-				compileAndRun(req.responseText);
-			});
-		} else {
-			compileAndRun(tags[i].innerHTML);
+	toplevel.onReady( function() {
+		var tags = qall('script[type="text/tabletprog"]');
+	
+		for (var i = 0; i < tags.length; ++i) {
+			if (tags[i].src) {
+				get(tags[i].src, function(req) {
+					compileAndRun(req.responseText);
+				});
+			} else {
+				compileAndRun(tags[i].innerHTML);
+			}
 		}
-	}
+	});
 });