| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Lingr tools
Revision: 43
Author: dburkes
Date: 10 Nov 2007 22:15:12
Changes:use a different hostname for observe, to avoid keep-alive problem
Files:| ... | ...@@ -12,4 +12,5 @@ | |
| 12 | 12 | this.options = { |
| 13 | 13 | prefix: Math.round(Math.random() * 100) + '.', |
| 14 | prefixForObserve: Math.round(Math.random() * 100) + 'o.', | |
| 14 | 15 | apiDomain: 'www.lingr.com', |
| 15 | 16 | dsrTimeout: 9000, |
| ... | ...@@ -30,6 +31,7 @@ | |
| 30 | 31 | emptyFunction: function() {}, |
| 31 | 32 | |
| 32 | url: function(path) { | |
| 33 | return "http://" + this.options.prefix + this.options.apiDomain + '/api' + path; | |
| 33 | url: function(path, observe) { | |
| 34 | var prefix = observe ? this.options.prefixForObserve : this.options.prefix; | |
| 35 | return "http://" + prefix + this.options.apiDomain + '/api' + path; | |
| 34 | 36 | }, |
| 35 | 37 | |
| ... | ...@@ -41,4 +43,5 @@ | |
| 41 | 43 | options = options || {}; |
| 42 | 44 | var head = document.getElementsByTagName('head')[0]; |
| 45 | var url = this.url(path, options.observe); | |
| 43 | 46 | var script; |
| 44 | 47 | if (this.options.useDsr) { |
| ... | ...@@ -61,5 +64,5 @@ | |
| 61 | 64 | script.type = 'text/javascript'; |
| 62 | 65 | script.charset = 'UTF-8'; |
| 63 | script.src = this.url(path) + '?' + this.formatParams(params); | |
| 66 | script.src = url + '?' + this.formatParams(params); | |
| 64 | 67 | head.appendChild(script); |
| 65 | 68 | this.timeout = setTimeout(params.callback, options.timeout || this.options.dsrTimeout); |
| ... | ...@@ -69,5 +72,5 @@ | |
| 69 | 72 | } |
| 70 | 73 | else { |
| 71 | new Ajax.Request(this.url(path), { | |
| 74 | new Ajax.Request(url, { | |
| 72 | 75 | method: method, |
| 73 | 76 | parameters: this.formatParams(params), |
| ... | ...@@ -355,5 +358,6 @@ | |
| 355 | 358 | onFailure: function(json) { |
| 356 | 359 | this.session.lingr.dispatchEvent('ApiFailure', json); |
| 357 | } | |
| 360 | }, | |
| 361 | observe: true | |
| 358 | 362 | }); |
| 359 | 363 | }, |