Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: packages/polymer/lib/src/job.dart

Issue 2312183003: Removed Polymer from Observatory deps (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/polymer/lib/src/instance.dart ('k') | packages/polymer/lib/src/loader.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/polymer/lib/src/job.dart
diff --git a/packages/polymer/lib/src/job.dart b/packages/polymer/lib/src/job.dart
deleted file mode 100644
index aa22f4794833d9a5c10331943a338fc05661daf7..0000000000000000000000000000000000000000
--- a/packages/polymer/lib/src/job.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of polymer;
-
-/// Like [Timer] but can be restarted, and if no duration is supplied uses
-/// [window.requestAnimationFrame] instead of a 0-duration timer.
-// TODO(jmesserly): need to find a better name here. Also this feels more like a
-// system level API, but doesn't map exactly to any of our other primitives.
-class PolymerJob {
- Function _callback;
- Timer _timer;
- int _id; // for requestAnimationFrame
-
- PolymerJob._();
-
- bool get isScheduled => _timer != null || _id != null;
-
- /// Starts the job. If the job is already running, it will [stop] first.
- void start(void callback(), [Duration wait]) {
- stop();
- _callback = callback;
- if (wait == null) {
- _id = window.requestAnimationFrame((_) => complete());
- } else {
- _timer = new Timer(wait, complete);
- }
- }
-
- /// Stops the job. It can be restarted by calling [start] with a new callback.
- void stop() {
- if (_id != null) {
- window.cancelAnimationFrame(_id);
- _id = null;
- }
- if (_timer != null) {
- _timer.cancel();
- _timer = null;
- }
- }
-
- /// Synchronously completes the job.
- void complete() {
- if (isScheduled) {
- stop();
- _callback();
- }
- }
-}
« no previous file with comments | « packages/polymer/lib/src/instance.dart ('k') | packages/polymer/lib/src/loader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698