diff options
Diffstat (limited to 'src/Server.js')
| -rw-r--r-- | src/Server.js | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/Server.js b/src/Server.js index 94b0cc10..d00f893b 100644 --- a/src/Server.js +++ b/src/Server.js @@ -1,6 +1,6 @@ // Copyright (C) 2008,2009 BRAT Tech LLC -nglr.Server = function(url, getScript) { +Server = function(url, getScript) { this.url = url; this.nextId = 0; this.getScript = getScript; @@ -8,51 +8,51 @@ nglr.Server = function(url, getScript) { this.maxSize = 1800; }; -nglr.Server.prototype.base64url = function(txt) { +Server.prototype.base64url = function(txt) { return Base64.encode(txt); }; -nglr.Server.prototype.request = function(method, url, request, callback) { +Server.prototype.request = function(method, url, request, callback) { var requestId = this.uuid + (this.nextId++); - nglr[requestId] = function(response) { - delete nglr[requestId]; + callbacks[requestId] = function(response) { + delete angular[requestId]; callback(200, response); }; var payload = {u:url, m:method, p:request}; - payload = this.base64url(nglr.toJson(payload)); + payload = this.base64url(toJson(payload)); var totalPockets = Math.ceil(payload.length / this.maxSize); var baseUrl = this.url + "/$/" + requestId + "/" + totalPockets + "/"; for ( var pocketNo = 0; pocketNo < totalPockets; pocketNo++) { var pocket = payload.substr(pocketNo * this.maxSize, this.maxSize); - this.getScript(baseUrl + (pocketNo+1) + "?h=" + pocket, nglr.noop); + this.getScript(baseUrl + (pocketNo+1) + "?h=" + pocket, noop); } }; -nglr.FrameServer = function(frame) { +FrameServer = function(frame) { this.frame = frame; }; -nglr.FrameServer.PREFIX = "$DATASET:"; +FrameServer.PREFIX = "$DATASET:"; -nglr.FrameServer.prototype = { +FrameServer.prototype = { read:function(){ - this.data = nglr.fromJson(this.frame.name.substr(nglr.FrameServer.PREFIX.length)); + this.data = fromJson(this.frame.name.substr(FrameServer.PREFIX.length)); }, write:function(){ - this.frame.name = nglr.FrameServer.PREFIX + nglr.toJson(this.data); + this.frame.name = FrameServer.PREFIX + toJson(this.data); }, request: function(method, url, request, callback) { - //alert(method + " " + url + " " + nglr.toJson(request) + " " + nglr.toJson(callback)); + //alert(method + " " + url + " " + toJson(request) + " " + toJson(callback)); } }; -nglr.VisualServer = function(delegate, status, update) { +VisualServer = function(delegate, status, update) { this.delegate = delegate; this.update = update; this.status = status; }; -nglr.VisualServer.prototype = { +VisualServer.prototype = { request:function(method, url, request, callback) { var self = this; this.status.beginRequest(request); @@ -61,7 +61,7 @@ nglr.VisualServer.prototype = { try { callback.apply(this, arguments); } catch (e) { - nglr.alert(nglr.toJson(e)); + alert(toJson(e)); } self.update(); }); |
