# An example using timers

    proc setTimeout {
      return ${{ setTimeout.apply(window, arguments) }}$;
    }

    proc getTime {
      return ${{ new Date().getTime() }}$;
    }

    startTime = getTime();
    upTime is systemTime - startTime;
    deltaTime is systemTime - lastTime;

    proc writeln {
      ${{ console.log.apply(console, arguments) }}$;
    }

    proc step : clock {
      if (clock == 1) {
        lastTime = systemTime;
        systemTime = getTime();
        setTimeout(step, 1);
      }
    }

    clock = 1;