running property

bool get running

Whether or not the game loop is running and the UI is refreshing itself every frame.

Initially off.

If you want to manually refresh the UI yourself when you know it needs to be updated -- maybe your game is explicitly turn-based -- you can leave this off.

Implementation

bool get running => _running;
set running (bool value)

Implementation

set running(bool value) {
  if (value == _running) return;

  _running = value;
  if (_running) {
    // Reset the start time so that we refresh immediately.
    _lastRefreshTime = null;

    html.window.requestAnimationFrame(_tick);
  }
}