Forráskód Böngészése

fix id GET request caching bug

Michelle Bu 12 éve
szülő
commit
be2875d2c7
3 módosított fájl, 4 hozzáadás és 0 törlés
  1. 2 0
      dist/peer.js
  2. 0 0
      dist/peer.min.js
  3. 2 0
      lib/peer.js

+ 2 - 0
dist/peer.js

@@ -1196,6 +1196,8 @@ Peer.prototype._getId = function(cb) {
   try {
   try {
     var http = new XMLHttpRequest();
     var http = new XMLHttpRequest();
     var url = 'http://' + this._options.host + ':' + this._options.port + '/' + this._options.key + '/id';
     var url = 'http://' + this._options.host + ':' + this._options.port + '/' + this._options.key + '/id';
+    var queryString = '?ts=' + new Date().getTime() + '' + Math.random();
+    url += queryString;
     // If there's no ID we need to wait for one before trying to init socket.
     // If there's no ID we need to wait for one before trying to init socket.
     http.open('get', url, true);
     http.open('get', url, true);
     http.onreadystatechange = function() {
     http.onreadystatechange = function() {

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 0
dist/peer.min.js


+ 2 - 0
lib/peer.js

@@ -61,6 +61,8 @@ Peer.prototype._getId = function(cb) {
   try {
   try {
     var http = new XMLHttpRequest();
     var http = new XMLHttpRequest();
     var url = 'http://' + this._options.host + ':' + this._options.port + '/' + this._options.key + '/id';
     var url = 'http://' + this._options.host + ':' + this._options.port + '/' + this._options.key + '/id';
+    var queryString = '?ts=' + new Date().getTime() + '' + Math.random();
+    url += queryString;
     // If there's no ID we need to wait for one before trying to init socket.
     // If there's no ID we need to wait for one before trying to init socket.
     http.open('get', url, true);
     http.open('get', url, true);
     http.onreadystatechange = function() {
     http.onreadystatechange = function() {

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott