Package elemental.dom

Examples of elemental.dom.TimeoutHandler


      throw new IllegalArgumentException("must be non-negative");
    }
    cancel();
    isRepeating = false;

    timerId = getWindow().setTimeout(new TimeoutHandler() {
      @Override
      public void onTimeoutHandler() {
        run();
      }
    }, delayMillis);
View Full Code Here


    if (periodMillis <= 0) {
      throw new IllegalArgumentException("must be positive");
    }
    cancel();
    isRepeating = true;
    timerId = getWindow().setInterval(new TimeoutHandler() {
      @Override
      public void onTimeoutHandler() {
        run();
      }
    }, periodMillis);
View Full Code Here

  /**
   * Tests that Window.setTimeout() works.
   */
  public void testTimeout() {
    delayTestFinish(1000);
    getWindow().setTimeout(new TimeoutHandler() {
      @Override
      public void onTimeoutHandler() {
        finishTest();
      }
    }, 500);
View Full Code Here

  /**
   * Tests that Window.setInterval() works repeatedly.
   */
  public void testInterval() {
    final int[] handle = new int[1];
    TimeoutHandler listener = new TimeoutHandler() {
      int count;
      @Override
      public void onTimeoutHandler() {
        // Make sure we see at least two events.
        ++count;
View Full Code Here

        ex[count++] = e;
      }
    });

    // Set a timeout and an interval, both of which will throw a RuntimException.
    getWindow().setTimeout(new TimeoutHandler() {
      @Override
      public void onTimeoutHandler() {
        throw new RuntimeException("w00t!");
      }
    }, 1);

    final int[] intervalHandle = new int[1];
    intervalHandle[0] = getWindow().setInterval(new TimeoutHandler() {
      @Override
      public void onTimeoutHandler() {
        // We only want this to happen once, so clear the interval timer on the
        // first fire.
        getWindow().clearInterval(intervalHandle[0]);
        throw new RuntimeException("w00t!");
      }
    }, 1);

    // Wait for the test to finish asynchronously, and setup another timer to
    // check that the exceptions got caught (this is kind of ugly, but there's
    // no way around it if we want to test the "real" timer implementation as
    // opposed to a mock implementation.
    delayTestFinish(5000);
    getWindow().setTimeout(new TimeoutHandler() {
      @Override
      public void onTimeoutHandler() {
        // Assert that exceptions got caught.
        assertNotNull(ex[0]);
        assertNotNull(ex[1]);
View Full Code Here

  private void update(ArrayOf<Runner> data) {
    // Sort & mutate source data.
    final ArrayOf<Runner> runners = normalize(data);

    // Update indexes later.
    Browser.getWindow().setTimeout(new TimeoutHandler() {
      @Override
      public void onTimeoutHandler() {
        for (int i = 0, n = runners.length(); i < n; ++i) {
          final Runner runner = runners.get(i);
View Full Code Here

    WorkspacePlace.PLACE.disableHistorySnapshotting();
    setIsActive(true, WorkspacePlace.PLACE);
    WorkspacePlace.PLACE.fireChildPlaceNavigation(createNavigationEvent(compile));
    WorkspacePlace.PLACE.enableHistorySnapshotting();

    Browser.getWindow().setTimeout(new TimeoutHandler() {
     
      @Override
      public void onTimeoutHandler() {
        WorkspacePlace.PLACE.disableHistorySnapshotting();
        WorkspacePlace.PLACE.fireChildPlaceNavigation(child);
View Full Code Here

      throw new IllegalArgumentException("must be positive");
    }
    cancel();
    isRepeating = false;

    timerId = getWindow().setTimeout(new TimeoutHandler() {
      @Override
      public void onTimeoutHandler() {
        run();
      }
    }, delayMillis);
View Full Code Here

    if (periodMillis <= 0) {
      throw new IllegalArgumentException("must be positive");
    }
    cancel();
    isRepeating = true;
    timerId = getWindow().setInterval(new TimeoutHandler() {
      @Override
      public void onTimeoutHandler() {
        run();
      }
    }, periodMillis);
View Full Code Here

TOP

Related Classes of elemental.dom.TimeoutHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.