repeated XMLHttpRequest GETs and displaying result

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dr J R Stockton

    #16
    Re: repeated XMLHttpRequest GETs and displaying result

    In comp.lang.javas cript message <g416ql$c4e$1$8 300dec7@news.de mon.co.uk>
    , Thu, 26 Jun 2008 23:56:16, Richard Cornford
    <Richard@litote s.demon.co.ukpo sted:
    > That undesirable routine would be more efficiently written as
    > function dopause(msecs) { var done = +new Date() + msecs;
    > while (new Date() < done) {} }
    >
    >Is there any point in a CPU spinning its wheels more efficiently?
    A shorter algorithm, where it works as well or better, is always an
    improvement. This one illustrates the point that no work that can be
    done outside a loop should be done within it (and unary +).

    If you still have access to the FAQ, how about correcting Section 5?

    --
    (c) John Stockton, nr London UK. ?@merlyn.demon. co.uk IE7 FF2 Op9 Sf3
    news:comp.lang. javascript FAQ <URL:http://www.jibbering.c om/faq/index.html>.
    <URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
    <URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.

    Comment

    • Jorge

      #17
      Re: repeated XMLHttpRequest GETs and displaying result

      On Jun 28, 12:42 am, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
      wrote:
      >
      Fx 2 exhibits the same behavior, and the Gecko source code shows why.
      >
      What ?
      In Spain it runs fine in FF2, Opera and Safari... jejeje.
      See : http://tinyurl.com/58tz3t

      What's going on here ?

      --Jorge.

      Comment

      • Jorge

        #18
        Re: repeated XMLHttpRequest GETs and displaying result

        On Jun 28, 10:58 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
        wrote:
        Yes, apparently Firebug when enabled modifies XHR enough so that it behaves
        quite different than implemented.  Now that you mention it, I remember to
        have seen several postings elsewhere that complained about XHR not properly
        working when Firebug was enabled.  However, I have not seen and did not
        expect it to mess with `onreadystatech ange' as well.  Unfortunately, itis
        still the same with Firebug 1.2.0b3.
        >
        Hmm, yeah, the code at http://tinyurl.com/58tz3t runs in FF3 as well,
        as long as firebug is enabled.

        I don't think that that's unfortunate, that's the way it should be. I
        can't figure out what's (Mozilla's) excuse to arbitrarily null a
        property of an object after it has been created and setup by my code.
        There's no need to, and other browsers don't do it.

        BTW, did you notice that "this" is setup differently in the
        onreadystatecha nge callback, in FF2 ? it points to the XHR object in
        Safari, Opera and FF3.

        Bye,
        --Jorge.

        Comment

        • Jorge

          #19
          Re: repeated XMLHttpRequest GETs and displaying result

          On Jun 28, 10:58 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
          wrote:
          (...)
          This and more is most obvious to everyone else but you,
          (...)
          Since I have no intention of repeating myself, I strongly suggest you learn
          how to extract meaning from already posted texts.
          (...)
          Score adjusted
          >
          Thomas, Thomas. Eat your pills.

          --Jorge.

          Comment

          • dhtml

            #20
            Re: repeated XMLHttpRequest GETs and displaying result

            On Jun 27, 3:42 pm, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
            wrote:
            Jorge wrote:
            Thomas 'PointedEars' Lahn wrote:
            Once you've seen an error message popping up when navigating away or a UA
            leaking memory because of a timeout or interval not properly cleared, you
            will see how wrong you are here.
            >
            I understand the need to clear a setInterval() timer, but not a
            setTimeout() that has already timed out.
            >
            How did you get that idea?
            >
            I don't see why calling clearTimeout there.
            =============== =============== ==============
            var t = window.setTimeo ut(
            function() {
            window.clearTim eout(t);
            =============== =============== ==============

            The callback function for setTimeout has already fired. What is the
            purpose for calling clearTimeout? The variable - t - is not even
            needed.

            Garrett
            PointedEars

            Comment

            Working...