OSDN Git Service

ファイルハンドラにxhrプロパティを追加
authordhrname <dhrname@users.sourceforge.jp>
Sun, 15 Sep 2013 13:21:21 +0000 (22:21 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Sun, 15 Sep 2013 13:21:21 +0000 (22:21 +0900)
tool/funcproto/openfile.js

index 8760a03..4b85b5d 100644 (file)
@@ -12,10 +12,11 @@ Function.prototype.open = function() {
   handle.read = function () {\r
     return this.join("\n");\r
   };\r
+  handle.xhr = xhr;\r
   handle.write = function (text) {\r
-    xhr.open("POST", fileName);\r
-    xhr.setRequestHeader("Content-Type" , "application/x-www-form-urlencoded");\r
-    xhr.send(text);\r
+    this.xhr.open("POST", fileName);\r
+    this.xhr.setRequestHeader("Content-Type" , "application/x-www-form-urlencoded");\r
+    this.xhr.send(text);\r
     return text;\r
   };\r
   xhr.onreadystatechange = function() {\r
@@ -26,7 +27,7 @@ Function.prototype.open = function() {
         if (fileNames.length !== 0) {\r
           fileName = fileNames.shift();\r
           f();\r
-        } else {                                  //Load End\r
+        } else {                                   //Load End\r
           xhr.onreadystatechange = Function.empty; //to solve the problem about a memory leak for IE 8\r
           that(handle);\r
           text = fileNames = xhr = handle = f = that = void 0;\r