public abstract class Scheduler
extends java.lang.Object
GWT.UncaughtExceptionHandler
if one is installed.
NOTE: If you are using a timer to schedule a UI animation, use
AnimationScheduler
instead. The
browser can optimize your animation for maximum performance.
StubScheduler
Modifier and Type | Class and Description |
---|---|
static interface |
Scheduler.RepeatingCommand
General-purpose Command interface for tasks that repeat.
|
static interface |
Scheduler.ScheduledCommand
General-purpose Command interface.
|
Constructor and Description |
---|
Scheduler() |
Modifier and Type | Method and Description |
---|---|
static Scheduler |
get()
Returns the default implementation of the Scheduler API.
|
abstract void |
scheduleDeferred(Scheduler.ScheduledCommand cmd)
A deferred command is executed after the browser event loop returns.
|
abstract void |
scheduleEntry(Scheduler.RepeatingCommand cmd)
An "entry" command will be executed before GWT-generated code is invoked by
the browser's event loop.
|
abstract void |
scheduleEntry(Scheduler.ScheduledCommand cmd)
An "entry" command will be executed before GWT-generated code is invoked by
the browser's event loop.
|
abstract void |
scheduleFinally(Scheduler.RepeatingCommand cmd)
A "finally" command will be executed before GWT-generated code returns
control to the browser's event loop.
|
abstract void |
scheduleFinally(Scheduler.ScheduledCommand cmd)
A "finally" command will be executed before GWT-generated code returns
control to the browser's event loop.
|
abstract void |
scheduleFixedDelay(Scheduler.RepeatingCommand cmd,
int delayMs)
Schedules a repeating command that is scheduled with a constant delay.
|
abstract void |
scheduleFixedPeriod(Scheduler.RepeatingCommand cmd,
int delayMs)
Schedules a repeating command that is scheduled with a constant
periodicity.
|
abstract void |
scheduleIncremental(Scheduler.RepeatingCommand cmd)
Schedules a repeating command that performs incremental work.
|
public static Scheduler get()
public abstract void scheduleDeferred(Scheduler.ScheduledCommand cmd)
public abstract void scheduleEntry(Scheduler.RepeatingCommand cmd)
Scheduler.RepeatingCommand
will be called once
per entry from the event loop until false
is returned. This
type of command is appropriate for instrumentation or code that needs to
know when "something happens."
If an entry command schedules another entry command, the second command will be executed before control flow continues to the GWT-generated code.
public abstract void scheduleEntry(Scheduler.ScheduledCommand cmd)
If an entry command schedules another entry command, the second command will be executed before control flow continues to the GWT-generated code.
public abstract void scheduleFinally(Scheduler.RepeatingCommand cmd)
Scheduler.RepeatingCommand.execute()
method will be called once per exit to the event loop until
false
is returned. This type of command is appropriate for
instrumentation or cleanup code.
If a finally command schedules another finally command, the second command will be executed before control flow returns to the browser.
public abstract void scheduleFinally(Scheduler.ScheduledCommand cmd)
If a finally command schedules another finally command, the second command will be executed before control flow returns to the browser.
Consider the following:
try { nativeEventCallback(); // Calls scheduleFinally one or more times } finally { executeFinallyCommands(); }
StyleInjector
public abstract void scheduleFixedDelay(Scheduler.RepeatingCommand cmd, int delayMs)
delayMs
milliseconds after the last invocation completes.
For example, assume that a command takes 30ms to run and a 100ms delay is provided. The second invocation of the command will occur at 130ms after the first invocation starts.
cmd
- the command to executedelayMs
- the amount of time to wait after one invocation ends before
the next invocationpublic abstract void scheduleFixedPeriod(Scheduler.RepeatingCommand cmd, int delayMs)
delayMs
milliseconds, regardless of how long the previous
invocation took to complete.cmd
- the command to executedelayMs
- the period with which the command is executedpublic abstract void scheduleIncremental(Scheduler.RepeatingCommand cmd)
cmd
- the command to execute