ICEfaces-EE
  1. ICEfaces-EE
  2. IPCK-209

Polling JavasSript restarts on every request

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: EE-2.0.0.Beta1
    • Component/s: Facelet Components
    • Labels:
      None
    • Environment:
      EE component showcase polling example, single or partial submit

      Description

      The polling example seems to be executing the polling JavaScript on every request resulting in a runaway timer.

      Another example of the polling JavaScript call was implemented like this.

       "<script language=\"JavaScript\" type=\"text/javascript\">\n" +
                  "// <![CDATA[\n" +
                  " function polingCall(){\n" +
                  " if (document.getElementById('polingForm')){\n"+
                  " document.getElementById('polingForm').submit();\n" +
                  " setTimeout( \"polingCall()\" , " + refreshFolderInterval + ");\n" +
                  " }\n" +
                  " }\n" +
                  "\n" +
                  "// ]]>\n" +
                  "</script>";

      Where polingColl() was called from the body onload attribute. We did figure out away to suppress the setInterval() Javascript call in the polling call from getting executed on every request.

        Activity

        Hide
        Carlo Guglielmin added a comment -

        r26018 - Updated the Javascript polling code so that it clears any previous poll before creating another one. This stops the runaway setInterval timers where three or four may be overlapping at once.

        The new polling code:

        <script type="text/javascript">
        //<![CDATA[
        var poll;

        function doPoll()
        {
        if (poll != undefined)

        { clearInterval(poll); }

        poll = setInterval( "iceSubmit(formOf($('pollingRequest')),$('pollingRequest'),new Object());" , #

        {interval}

        );
        }

        doPoll();
        //]]>
        </script>

        Show
        Carlo Guglielmin added a comment - r26018 - Updated the Javascript polling code so that it clears any previous poll before creating another one. This stops the runaway setInterval timers where three or four may be overlapping at once. The new polling code: <script type="text/javascript"> //<![CDATA[ var poll; function doPoll() { if (poll != undefined) { clearInterval(poll); } poll = setInterval( "iceSubmit(formOf($('pollingRequest')),$('pollingRequest'),new Object());" , # {interval} ); } doPoll(); //]]> </script>

          People

          • Assignee:
            Carlo Guglielmin
            Reporter:
            Patrick Corless
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: