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

Side by Side Diff: dart/site/try/src/user_option.dart

Issue 350443006: Add secret option "live" which compiles more frequently. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add comment Created 6 years, 6 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 | « dart/site/try/src/settings.dart ('k') | no next file » | 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) 2014, the Dart project authors. Please see the AUTHORS file 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 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 library trydart.userOption; 5 library trydart.userOption;
6 6
7 /// Persistent user-configurable option.
8 ///
9 /// Options included in [options] in settings.dart will automatically be
10 /// included in the settings UI unless [isHidden] is true.
11 ///
12 /// The value of an option is persisted in [storage] which is normally the
13 /// browser's "localStorage", and [name] is a key in "localStorage". This
14 /// means that hidden options can be controlled by opening the JavaScript
15 /// console and evaluate:
16 ///
17 /// localStorage['name'] = value // or
18 /// localStorage.name = value
19 ///
20 /// An option can be reset to the default value using:
21 ///
22 /// delete localStorage['name'] // or
23 /// delete localStorage.name
7 class UserOption { 24 class UserOption {
8 final String name; 25 final String name;
9 26
10 final bool isHidden; 27 final bool isHidden;
11 28
12 static var storage; 29 static var storage;
13 30
14 const UserOption(this.name, {this.isHidden: false}); 31 const UserOption(this.name, {this.isHidden: false});
15 32
16 get value => storage[name]; 33 get value => storage[name];
(...skipping 17 matching lines...) Expand all
34 class StringUserOption extends UserOption { 51 class StringUserOption extends UserOption {
35 const StringUserOption(String name, {bool isHidden: false}) 52 const StringUserOption(String name, {bool isHidden: false})
36 : super(name, isHidden: isHidden); 53 : super(name, isHidden: isHidden);
37 54
38 String get value => super.value == null ? '' : super.value; 55 String get value => super.value == null ? '' : super.value;
39 56
40 void set value(String newValue) { 57 void set value(String newValue) {
41 super.value = newValue; 58 super.value = newValue;
42 } 59 }
43 } 60 }
OLDNEW
« no previous file with comments | « dart/site/try/src/settings.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698