library scroll_app; import 'dart:async'; import 'dart:html'; import 'package:angular/angular.dart'; import 'package:angular2/src/test_lib/benchmark_util.dart'; @Component( selector: 'scroll-app', template: '''

Following tables are only here to add weight to the UI:

''') class App implements ShadowRootAware { final VmTurnZone ngZone; List scrollAreas; int scrollTop = 0; int iterationCount; int scrollIncrement; App(this.ngZone) { int appSize = getIntParameter('appSize'); iterationCount = getIntParameter('iterationCount'); scrollIncrement = getIntParameter('scrollIncrement'); appSize = appSize > 1 ? appSize - 1 : 0; // draw at least one table scrollAreas = new List.generate(appSize, (i) => i); } @override void onShadowRoot(ShadowRoot shadowRoot) { bindAction('#run-btn', () { runBenchmark(); }); bindAction('#reset-btn', () { scrollTop = 0; }); } void runBenchmark() { int n = iterationCount; scheduleScroll() { new Future(() { scrollTop += scrollIncrement; n--; if (n > 0) { scheduleScroll(); } }); } scheduleScroll(); } }