/[meteor]/googlecode.com/svn/trunk/public_html/meteor.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /googlecode.com/svn/trunk/public_html/meteor.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 24 by andrew.betts, Sun May 20 14:19:00 2007 UTC revision 29 by andrew.betts, Wed Oct 10 22:18:30 2007 UTC
# Line 30  function Meteor(instID) { Line 30  function Meteor(instID) {
30          this.callback_eof = function() {};          this.callback_eof = function() {};
31          this.callback_changemode = function() {};          this.callback_changemode = function() {};
32          this.callback_statuschanged = function() {};          this.callback_statuschanged = function() {};
33          this.persist = true;          this.persist = 1;
34          this.frameloadtimer = false;          this.frameloadtimer = false;
35          this.debugmode = false;          this.debugmode = false;
36          this.subsurl = false;          this.subsurl = false;
# Line 42  function Meteor(instID) { Line 42  function Meteor(instID) {
42          // Documented public properties          // Documented public properties
43          this.subdomain = "data";          this.subdomain = "data";
44          this.dynamicpageaddress = "push";          this.dynamicpageaddress = "push";
45          this.smartpoll = true;          this.smartpoll = 1;
46          this.pollfreq = 2000;          this.pollfreq = 2000;
47          this.minpollfreq = 2000;          this.minpollfreq = 2000;
48          this.mode = "poll";          this.mode = "stream";
49          this.polltimeout = 30000;          this.polltimeout = 30000;
50          this.pingtimeout = 10000;          this.pingtimeout = 10000;
51          this.maxmessages = 0;          this.maxmessages = 0;
# Line 90  Meteor.reset = function(ifr) { Line 90  Meteor.reset = function(ifr) {
90          this.instances[instid].reset();          this.instances[instid].reset();
91  }  }
92    
93    window.onunload = function() {
94            for (var i in Meteor.instances) {
95                    if (Meteor.instances[i].transferDoc) delete Meteor.instances[i].transferDoc;
96            }
97    }
98    
99    
100  Meteor.prototype.joinChannel = function(channelname, backtrack) {  Meteor.prototype.joinChannel = function(channelname, backtrack) {
101          if (typeof(this.channels[channelname]) != "undefined") throw "Cannot join channel "+channelname+": already subscribed";          if (typeof(this.channels[channelname]) != "undefined") throw "Cannot join channel "+channelname+": already subscribed";
102          this.channels[channelname] = {backtrack:backtrack, lastmsgreceived:0};          this.channels[channelname] = {backtrack:backtrack, lastmsgreceived:0};
# Line 107  Meteor.prototype.leaveChannel = function Line 114  Meteor.prototype.leaveChannel = function
114  }  }
115    
116  Meteor.prototype.start = function() {  Meteor.prototype.start = function() {
117          this.persist = (this.maxmessages)?1:0;          this.persist = (this.persist)?1:0;
118          this.smartpoll = (this.smartpoll)?1:0;          this.smartpoll = (this.smartpoll)?1:0;
119          this.mode = (this.mode=="stream")?"stream":"poll";          this.mode = (this.mode=="stream")?"stream":"poll";
120          if (!this.subdomain || !this.channelcount) throw "Channel or Meteor subdomain host not specified";          if (!this.subdomain || !this.channelcount) throw "Channel or Meteor subdomain host not specified";
# Line 136  Meteor.prototype.start = function() { Line 143  Meteor.prototype.start = function() {
143  }  }
144    
145  Meteor.prototype.updateSubsUrl = function() {  Meteor.prototype.updateSubsUrl = function() {
146    
147            // If streaming or long polling, connection should persist
148            this.persist = (this.mode == "stream" || (this.mode=='poll' && this.maxmessages > 0)) ? 1 : 0;
149          var surl = "http://" + this.subdomain + "." + location.hostname + "/" + this.dynamicpageaddress + "?id=" + this.MHostId;          var surl = "http://" + this.subdomain + "." + location.hostname + "/" + this.dynamicpageaddress + "?id=" + this.MHostId;
150          if (this.maxmessages && this.persist && this.mode != "stream") surl += "&maxmessages=" + this.maxmessages;          if (this.persist && this.mode != "stream") surl += "&maxmessages=" + this.maxmessages;
         if (this.mode == "poll" && this.maxmessages == 0 && this.persist==1) this.persist=0;  
151          surl += "&persist="+this.persist;          surl += "&persist="+this.persist;
152          for (var c in this.channels) {          for (var c in this.channels) {
153                  surl += "&channel="+c;                  surl += "&channel="+c;
# Line 154  Meteor.prototype.updateSubsUrl = functio Line 163  Meteor.prototype.updateSubsUrl = functio
163  }  }
164    
165  Meteor.prototype.createIframe = function(url) {  Meteor.prototype.createIframe = function(url) {
166          if (document.all) {          delete this.transferDoc;
167            if (document.all) try { this.transferDoc = new ActiveXObject("htmlfile") } catch(ex) { this.transferDoc = null }
168            if (document.all && this.transferDoc) {
169                  this.transferDoc = new ActiveXObject("htmlfile");                  this.transferDoc = new ActiveXObject("htmlfile");
170                  this.transferDoc.open();                  this.transferDoc.open();
171                  this.transferDoc.write("<html>");                  this.transferDoc.write("<html>");

Legend:
Removed from v.24  
changed lines
  Added in v.29

  ViewVC Help
Powered by ViewVC 1.1.26