This repository has been archived by the owner on Dec 19, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Migration Guide
Jacob MacDonald edited this page Jan 6, 2016
·
13 revisions
Your best bet is to look at examples that have already been converted:
The rest of this page has details on the conversion of Stopwatch.
The stopwatch example demonstrates a simple stopwatch using Polymer dart. It was originally implemented using a pre-1.0 version of Polymer dart and has been updated to 1.0. The following sections highlight the important changes. For each change, the relevant line number(s) are called out in parentheses.
- Change the polymer dependency to
^1.0.0
(5). - Add dependencies for web_components (6), browser (7).
- Add a constraint on the Dart SDK (17).
The index.dart file is not strictly needed, but is good practice. This kicks off the Polymer app.
- Include the web_components (14), dart_support (15), and browser/dart (27) scripts.
- Specify index.dart as the application/dart script (26).
- Add a library name that has the
@HtmlImports
annotation (3 and 4). See Dart-to-HTML imports. - Import web_components.dart (10).
- On the TuteStopWatch class, which extends PolymerElement, change the
@CustomTag
annotation to@PolymerRegister
(12). See Registration and Lifecycle. -
@observable
is no longer supported. You can create this functionality by specifying@Property(observer:
(15) on the variable, implementing an event handler (72), and callingnotifyPath
on the variable when value changes (67, 85). - The start (44), stop (54), reset (63), and updateTime (72) functions are now marked with the
@reflectable
annotation. See Properties. - Whenever the value of the counter object, call
notifyPath
with the new value (67, 85). See Data Binding Syntax.
- Replace
<polymer-element>
tag with<dom-module>
. See Local DOM. -
Remove all white space, including newlines, between the
<div>/</div>
tags and the curly braces (20). See Binding to text content. - Remove the curly braces around the stop, start, and reset functions (22,23,24).