OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 library fn; | 5 library fn; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:sky' as sky; | 9 import 'dart:sky' as sky; |
10 import 'reflect.dart' as reflect; | 10 import 'reflect.dart' as reflect; |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 | 672 |
673 var vdom = _vdom; | 673 var vdom = _vdom; |
674 while (vdom is Component) { | 674 while (vdom is Component) { |
675 vdom = vdom._vdom; | 675 vdom = vdom._vdom; |
676 } | 676 } |
677 | 677 |
678 assert(vdom._root != null); | 678 assert(vdom._root != null); |
679 _syncInternal(); | 679 _syncInternal(); |
680 } | 680 } |
681 | 681 |
| 682 void scheduleBuild() { |
| 683 setState(() {}); |
| 684 } |
| 685 |
682 void setState(Function fn()) { | 686 void setState(Function fn()) { |
683 assert(_vdom != null || _defunct); // cannot setState before mounting. | 687 assert(_vdom != null || _defunct); // cannot setState before mounting. |
684 _stateful = true; | 688 _stateful = true; |
685 fn(); | 689 fn(); |
686 if (!_defunct && _currentlyRendering != this) { | 690 if (!_defunct && _currentlyRendering != this) { |
687 _dirty = true; | 691 _dirty = true; |
688 _scheduleComponentForRender(this); | 692 _scheduleComponentForRender(this); |
689 } | 693 } |
690 } | 694 } |
691 | 695 |
(...skipping 11 matching lines...) Expand all Loading... |
703 | 707 |
704 _mount(null, _host, null); | 708 _mount(null, _host, null); |
705 assert(_root is sky.Node); | 709 assert(_root is sky.Node); |
706 | 710 |
707 sw.stop(); | 711 sw.stop(); |
708 if (_shouldLogRenderDuration) | 712 if (_shouldLogRenderDuration) |
709 print("Initial build: ${sw.elapsedMicroseconds} microseconds"); | 713 print("Initial build: ${sw.elapsedMicroseconds} microseconds"); |
710 }); | 714 }); |
711 } | 715 } |
712 } | 716 } |
OLD | NEW |