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

Side by Side Diff: sky/examples/fn/lib/style.dart

Issue 971183002: Initial commit of Effen reactive framework experiment for Sky (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « sky/examples/fn/lib/reflect.dart ('k') | sky/examples/fn/widgets/animationgenerator.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 part of fn;
2
3 class Style {
4 final String _className;
5 static Map<String, Style> _cache = null;
6
7 static int nextStyleId = 1;
8
9 static String nextClassName(String styles) {
10 assert(sky.document != null);
11 var className = "style$nextStyleId";
12 nextStyleId++;
13
14 var styleNode = sky.document.createElement('style');
15 styleNode.setChild(new sky.Text(".$className { $styles }"));
16 sky.document.appendChild(styleNode);
17
18 return className;
19 }
20
21 factory Style(String styles) {
22 if (_cache == null) {
23 _cache = new HashMap<String, Style>();
24 }
25
26 var style = _cache[styles];
27 if (style == null) {
28 style = new Style._internal(nextClassName(styles));
29 _cache[styles] = style;
30 }
31
32 return style;
33 }
34
35 Style._internal(this._className);
36 }
OLDNEW
« no previous file with comments | « sky/examples/fn/lib/reflect.dart ('k') | sky/examples/fn/widgets/animationgenerator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698