diff options
| author | Misko Hevery | 2010-03-26 16:27:18 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-03-26 16:27:18 -0700 |
| commit | 258ca5f16581f0e8befa493644225a02ae2fc002 (patch) | |
| tree | a7d67c586fb5c870619664ca84e17996f6dd2e6d /src/Server.js | |
| parent | 1990cbbf2817e04657ccd616da1d9d6b78cc2949 (diff) | |
| download | angular.js-258ca5f16581f0e8befa493644225a02ae2fc002.tar.bz2 | |
moved all uneeded files out, widgets.html works, tests horribly broken
Diffstat (limited to 'src/Server.js')
| -rw-r--r-- | src/Server.js | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/src/Server.js b/src/Server.js deleted file mode 100644 index 5c4ec3c6..00000000 --- a/src/Server.js +++ /dev/null @@ -1,68 +0,0 @@ -function Server(url, getScript) { - this.url = url; - this.nextId = 0; - this.getScript = getScript; - this.uuid = "_" + ("" + Math.random()).substr(2) + "_"; - this.maxSize = 1800; -}; - -Server.prototype = { - base64url: function(txt) { - return Base64.encode(txt); - }, - - request: function(method, url, request, callback) { - var requestId = this.uuid + (this.nextId++); - var payload = this.base64url(toJson({'u':url, 'm':method, 'p':request})); - var totalPockets = Math.ceil(payload.length / this.maxSize); - var baseUrl = this.url + "/$/" + requestId + "/" + totalPockets + "/"; - angularCallbacks[requestId] = function(response) { - delete angularCallbacks[requestId]; - callback(200, response); - }; - for ( var pocketNo = 0; pocketNo < totalPockets; pocketNo++) { - var pocket = payload.substr(pocketNo * this.maxSize, this.maxSize); - this.getScript(baseUrl + (pocketNo+1) + "?h=" + pocket, noop); - } - } -}; - -function FrameServer(frame) { - this.frame = frame; -}; -FrameServer.PREFIX = "$DATASET:"; - -FrameServer.prototype = { - read:function(){ - this.data = fromJson(this.frame.name.substr(FrameServer.PREFIX.length)); - }, - write:function(){ - this.frame.name = FrameServer.PREFIX + toJson(this.data); - }, - request: function(method, url, request, callback) { - //alert(method + " " + url + " " + toJson(request) + " " + toJson(callback)); - } -}; - - -function VisualServer(delegate, status, update) { - this.delegate = delegate; - this.update = update; - this.status = status; -}; - -VisualServer.prototype = { - request:function(method, url, request, callback) { - var self = this; - this.status.beginRequest(request); - this.delegate.request(method, url, request, function() { - self.status.endRequest(); - try { - callback.apply(this, arguments); - } catch (e) { - alert(toJson(e)); - } - self.update(); - }); - } -}; |
