[cells-devel] [openair] recv function ?!
Andy, I am currently trying to figure out why I don't get any update on my browser of, if any, just once. When looking at the recv function in openair.js I see: function recv (data) { var response = eval("[" + data + "]"); for(var i=0; i<data.length; i++) { eval(response[i]); } } Kind of weird to me... I'd understand if it read: function recv (data) { var response = eval("[" + data + "]"); for(var i=0; i<response.length; i++) { eval(response[i]); } } Andy, would you be so kind as to explain what you want to achieve ... Many, many thanks! Even more: I learned that JS goes into the for loop even if length is 0. So we might want to check or change the for loop... Cheers - Frank
Frank Goenninger wrote:
Andy,
I am currently trying to figure out why I don't get any update on my browser of, if any, just once. When looking at the recv function in openair.js I see:
function recv (data) { var response = eval("[" + data + "]"); for(var i=0; i<data.length; i++) { eval(response[i]); } }
Kind of weird to me... I'd understand if it read:
function recv (data) { var response = eval("[" + data + "]"); for(var i=0; i<response.length; i++) { eval(response[i]); } }
Hmmm, if that was a typo then the loop would iterate once for each character in the response evaluating (eventually) non-existent responses which should be fast but... we have been wondering my the thing was hugely slow at times, I will try this fix later. Nice catch, Frank! (It looks like a catch to me.) btw, JS goes into the loop even when the conditionis false initially? Hard to believe they got that wrong. I will add a preemptive strike anyway, cannot hurt. kt
Am 14.04.2008 um 21:23 schrieb Ken Tilton:
Frank Goenninger wrote:
Andy, I am currently trying to figure out why I don't get any update on my browser of, if any, just once. When looking at the recv function in openair.js I see: function recv (data) { var response = eval("[" + data + "]"); for(var i=0; i<data.length; i++) { eval(response[i]); } } Kind of weird to me... I'd understand if it read: function recv (data) { var response = eval("[" + data + "]"); for(var i=0; i<response.length; i++) { eval(response[i]); } }
Hmmm, if that was a typo then the loop would iterate once for each character in the response evaluating (eventually) non-existent responses which should be fast but... we have been wondering my the thing was hugely slow at times, I will try this fix later.
Nice catch, Frank! (It looks like a catch to me.) btw, JS goes into the loop even when the conditionis false initially? Hard to believe they got that wrong. I will add a preemptive strike anyway, cannot hurt.
Showed up in the Firebug Debugger (Firefox *really* is /the/ choice for Web developers ...) - I will check again if this really happens - wait a minute ... Yep - it is entering the for loop: response.length is 0 and it executes the eval in the loop... Cheers (that nice brown liquid right beside me is yelling "Drink me" - well, it's been in the cask for 18 year so let's swallow it sloooowly ... mmmmh ...) Frank
Hey,all. Now my ISP considers uptime optional. :( Chatting from starbucks. :) Anydody want to email me a new-improved openair.js and/or source tree before I head home? This is there second outage in as many days, I guess their sys admin is thrashing. Anyway, generally only down for a few hours at a time, but.... well, there is always starbucks! kt
participants (3)
-
Frank Goenninger
-
Ken Tilton
-
Ken Tilton