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

Side by Side Diff: samples/todomvc/dart/todomvc_presenter.dart

Issue 2035023003: Remove service-compiler related code. (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Created 4 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
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dartino 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.md file.
4
5 // Should become auto-generated.
6
7 library todomvc_presenter;
8
9 import 'todomvc_service.dart';
10 import 'todomvc_presenter_model.dart';
11
12 abstract class TodoMVCPresenter extends TodoMVCService {
13
14 var _presentation = new Nil();
15 var _eventManager = new EventManager();
16
17 // Construct a "presenter model" from the model.
18 Immutable render(Immutable previous);
19
20 // Compare two "presenter models" to calculate a patch set for the host.
21 MyPatchSet diff(Immutable previous, Immutable current) {
22 var patchSet = new MyPatchSet();
23 current.diff(previous, null, patchSet);
24 for (var patch in patchSet.patches) {
25 trace("{ path: ${patch.path}, content: ${patch.content} }");
26 }
27 return patchSet;
28 }
29
30 // Update the presentation and get the current patch set.
31 MyPatchSet update() {
32 var previous = _presentation;
33 _presentation = render(previous);
34 return diff(previous, _presentation);
35 }
36
37 // Entry point for synchronizing with the host mirror.
38 void sync(PatchSetBuilder result) {
39 update().serialize(result, _eventManager);
40 }
41
42 void reset() {
43 _presentation = new Nil();
44 _eventManager.clear();
45 }
46
47 void dispatch(int eventHandlerId) {
48 _eventManager.call(eventHandlerId);
49 }
50 }
OLDNEW
« no previous file with comments | « samples/todomvc/dart/presentation_graph.dart ('k') | samples/todomvc/dart/todomvc_presenter_model.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698