commit 5ea5b055514c7432755cd5570180c92314ec87b9
parent 73e36d5258a78e366ab77048101947afb77b880d
Author: Alexander Burger <abu@software-lab.de>
Date: Tue, 21 May 2013 11:19:05 +0200
Local request object in Canvas
Diffstat:
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/lib/canvas.js b/lib/canvas.js
@@ -1,21 +1,19 @@
-/* 16may13abu
+/* 21may13abu
* (c) Software Lab. Alexander Burger
*/
-var DrawReq = new XMLHttpRequest();
-
function drawCanvas(id, dly) {
- if (!DrawReq)
- return true;
+ var req = new XMLHttpRequest();
+
try {
- DrawReq.open("POST",
+ req.open("POST",
document.getElementsByTagName("BASE")[0].href + SesId +
"!jsDraw?" + id );
- DrawReq.responseType = "arraybuffer";
+ req.responseType = "arraybuffer";
}
catch (e) {return true;}
- DrawReq.onload = function() {
- var lst = plio(new Uint8Array(DrawReq.response));
+ req.onload = function() {
+ var lst = plio(new Uint8Array(req.response));
var cmd, i;
if (lst) {
@@ -125,9 +123,9 @@ function drawCanvas(id, dly) {
}
setTimeout(function() {drawCanvas(id, dly)}, dly);
}
- try {DrawReq.send(null);}
+ try {req.send(null);}
catch (e) {
- DrawReq.abort();
+ req.abort();
return true;
}
return false;