]> gitweb.factorcode.org Git - factor.git/commitdiff
fjsc: add http-get
authorchris.double <chris.double@double.co.nz>
Fri, 15 Dec 2006 13:36:38 +0000 (13:36 +0000)
committerchris.double <chris.double@double.co.nz>
Fri, 15 Dec 2006 13:36:38 +0000 (13:36 +0000)
apps/furnace-fjsc/resources/bootstrap.js

index c25acb02e5fb72ad077ad3f6b0aa6837cacbd0d8..5005852cc5ea06fbc14d1e4e8661197065aa3bd9 100644 (file)
@@ -24,6 +24,7 @@ function Factor() {
     "empty?": function() { self.fjsc_is_empty(); },
     "window": function() { self.fjsc_window(); },
     "run-file": function() { self.fjsc_run_file(); },
+    "http-get": function() { self.fjsc_http_get(); },
     "bootstrap": function() { self.fjsc_bootstrap(); }
   };  
 }
@@ -208,6 +209,25 @@ Factor.prototype.fjsc_run_file = function() {
    YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
 }
 
+Factor.prototype.fjsc_http_get = function() {
+   var self = this;
+   var stack = this.data_stack;
+   var url = stack.pop();
+   var callback = {
+     success: function(o) {
+       var result = o.responseText;
+       self.data_stack.push(result);
+       self.display_datastack();
+     },
+     failure: function(o) {
+       alert('http-get failed');
+     }
+   };
+
+   YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
+}
+
+
 Factor.prototype.fjsc_bootstrap = function() {
    this.data_stack.push("/responder/fjsc-resources/bootstrap.factor");
    this.fjsc_run_file();