intervals - JavaScript Resource while in a loop -
i have small script...
var foo = function (){ ... stuff here ... settimeout(foo, 1); } foo();
so asking foo call once it's finished giving 1 millisecond break,
so run forever until browser refresh etc...
question:
i want avoid overwhelming browsers or causing crashes bad idea, or there need consider avoid crashes?
the idea runs through , wait's happen it.
i'd have long , short of it. that's basic pattern, though may want make execute @ least once first. ;-)
(function(){ var foo = function(){ settimeout(foo, 1e3); }(); })();
though doubt execute every 1ms (and whatever you're doing can't need that often, can it?). if testing form server, @ using long polling. if you're checking change in browser, @ binding specific events , not checking delta.
Comments
Post a Comment