@@ -24,13 +24,12 @@ more info) like so:
24
24
dart -c bin/generator.dart
25
25
```
26
26
27
- You can then build the app using pub:
27
+ You can then run the app in Dart Editor:
28
+ Right-click ** Chapter_07/web/index.html** , and choose ** Run as JavaScript** .
28
29
29
- ```
30
- pub build
31
- ```
32
-
33
- You can now launch the app ` build/index.html ` using the browser of your choice.
30
+ After the app is compiled to JavaScript,
31
+ the app should appear in your default browser.
32
+ You can copy the app's URL into any other browser you'd like to test.
34
33
35
34
36
35
# Overview
@@ -84,40 +83,24 @@ reducing the output size.
84
83
85
84
``` @MirrorsUsed ``` is often hard to get right as it really depends on how/if
86
85
you use code generation (discussed later in "Optimizing Runtime Performance"
87
- chapter). Assuming you do use code generation (as we do in this chapter) your
88
- annotation could look something like this:
86
+ chapter). Assuming you do use code generation (as we do in this chapter) and
87
+ are using angular 0.9.5, your annotation could look like this:
89
88
90
89
```
91
90
@MirrorsUsed(
92
- targets: const [
93
- 'angular.core',
94
- 'angular.core.dom',
95
- 'angular.core.parser',
96
- 'angular.routing',
97
- 'NodeTreeSanitizer'
98
- ],
99
91
metaTargets: const [
100
- NgInjectableService,
101
- NgComponent,
102
- NgDirective,
103
- NgController,
104
- NgFilter,
105
- NgAttr,
106
- NgOneWay,
107
- NgOneWayOneTime,
108
- NgTwoWay,
109
- NgCallback
92
+ NgFilter
110
93
],
111
94
override: '*'
112
95
)
113
96
import 'dart:mirrors';
114
97
```
115
98
116
99
Here you are essentually telling dart2js that your application reflects on
117
- ``` angular.core ``` , ``` angular.core.dom ``` , ``` angular.core.parser ``` , etc .
118
- libraries, as well as on ``` NodeTreeSanitizer ``` class, and annotations
119
- (metaTargets) like ``` NgInjectableService ``` , ``` NgComponent ``` ,
120
- ``` NgDirective ``` , etc.
100
+ classes annotated with @ NgFilter .
101
+ (The @ MirrorsUsed code for this app used to be much longer, but as of 0.9.5,
102
+ Angular has default definitions that
103
+ include the APIs you're likely to need.)
121
104
122
105
### Debugging
123
106
@@ -319,7 +302,7 @@ or the debug version:
319
302
<script src="packages/shadow_dom/shadow_dom.debug.js"></script>
320
303
```
321
304
322
- ** NOTE:** using the polyfill has [ some limitations] [ shadowdom-limitations ] ,
305
+ ** NOTE:** Using the polyfill has [ some limitations] [ shadowdom-limitations ] ,
323
306
so make sure you are aware of those limitations before you start using it.
324
307
325
308
[ dart-mirrors-api ] : https://api.dartlang.org/docs/channels/stable/latest/dart_mirrors.html
0 commit comments