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

Side by Side Diff: pkg/polymer/lib/platform.dart

Issue 25428003: Fix warnings and hints. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Less hiding FTW. Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/utf/lib/utf.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Exposes helper functionality for interacting with the platform. Similar to 6 * Exposes helper functionality for interacting with the platform. Similar to
7 * the [Platform] class from dart:html. 7 * the [Platform] class from dart:html.
8 */ 8 */
9 // TODO(jmesserly): in Polymer this is a static class called "Platform", but 9 // TODO(jmesserly): in Polymer this is a static class called "Platform", but
10 // that conflicts with dart:html. What should we do? Does this functionality 10 // that conflicts with dart:html. What should we do? Does this functionality
11 // belong in html's Platform instead? 11 // belong in html's Platform instead?
12 library polymer.platform; 12 library polymer.platform;
13 13
14 import 'dart:async' show Completer;
14 import 'dart:html' show Text, MutationObserver; 15 import 'dart:html' show Text, MutationObserver;
15 import 'dart:collection' show Queue; 16 import 'dart:collection' show Queue;
16 import 'package:observe/src/microtask.dart' show performMicrotaskCheckpoint; 17 import 'package:observe/src/microtask.dart' show performMicrotaskCheckpoint;
17 18
18 void flush() { 19 void flush() {
19 endOfMicrotask(performMicrotaskCheckpoint); 20 endOfMicrotask(performMicrotaskCheckpoint);
20 } 21 }
21 22
22 int _iterations = 0; 23 int _iterations = 0;
23 final Queue _callbacks = new Queue(); 24 final Queue _callbacks = new Queue();
24 final Text _twiddle = () { 25 final Text _twiddle = () {
25 var twiddle = new Text(''); 26 var twiddle = new Text('');
26 new MutationObserver((x, y) { 27 new MutationObserver((x, y) {
27 while (_callbacks.isNotEmpty) { 28 while (_callbacks.isNotEmpty) {
28 try { 29 try {
29 _callbacks.removeFirst()(); 30 _callbacks.removeFirst()();
30 } catch (e) { // Dart note: fire the error async. 31 } catch (e) { // Dart note: fire the error async.
31 new Completer().completeError(e); 32 new Completer().completeError(e);
32 } 33 }
33 } 34 }
34 }).observe(twiddle, characterData: true); 35 }).observe(twiddle, characterData: true);
35 return twiddle; 36 return twiddle;
36 }(); 37 }();
37 38
38 void endOfMicrotask(void callback()) { 39 void endOfMicrotask(void callback()) {
39 _twiddle.text = '${_iterations++}'; 40 _twiddle.text = '${_iterations++}';
40 _callbacks.add(callback); 41 _callbacks.add(callback);
41 } 42 }
OLDNEW
« no previous file with comments | « no previous file | pkg/utf/lib/utf.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698