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

Side by Side Diff: samples/pop_pop_win/lib/platform_target.dart

Issue 786443002: Delete pop-pop-win from the repo (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 | « samples/pop_pop_win/lib/assets/style.css ('k') | samples/pop_pop_win/lib/pop_pop_win.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
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.
4 library pop_pop_win.platform_target;
5
6 import 'dart:async';
7
8 abstract class PlatformTarget {
9 bool _initialized = false;
10
11 factory PlatformTarget() => new _DefaultPlatform();
12
13 PlatformTarget.base();
14
15 bool get initialized => _initialized;
16
17 void initialize() {
18 assert(!_initialized);
19 _initialized = true;
20 }
21
22 Future clearValues();
23
24 Future setValue(String key, String value);
25
26 Future<String> getValue(String key);
27
28 int get size;
29
30 bool get showAbout;
31
32 void toggleAbout([bool value]);
33
34 Stream get aboutChanged;
35 }
36
37 class _DefaultPlatform extends PlatformTarget {
38 final Map<String, String> _values = new Map<String, String>();
39 final StreamController _aboutController = new StreamController(sync: true);
40 bool _about = false;
41
42 _DefaultPlatform() : super.base();
43
44 @override
45 Future clearValues() => new Future(_values.clear);
46
47 @override
48 Future setValue(String key, String value) =>
49 new Future(() { _values[key] = value; });
50
51 @override
52 Future<String> getValue(String key) => new Future(() => _values[key]);
53
54 int get size => 7;
55
56 void toggleAbout([bool value]) {
57 assert(_about != null);
58 if (value == null) {
59 value = !_about;
60 }
61 _about = value;
62 _aboutController.add(null);
63 }
64
65 bool get showAbout => _about;
66
67 Stream get aboutChanged => _aboutController.stream;
68 }
OLDNEW
« no previous file with comments | « samples/pop_pop_win/lib/assets/style.css ('k') | samples/pop_pop_win/lib/pop_pop_win.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698