Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 49c1b65

Browse files
committed
Update @MirrorsUsed and run instructions
1 parent e303c77 commit 49c1b65

File tree

1 file changed

+13
-30
lines changed

1 file changed

+13
-30
lines changed

Chapter_07/README.md

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ more info) like so:
2424
dart -c bin/generator.dart
2525
```
2626

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**.
2829

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.
3433

3534

3635
# Overview
@@ -84,40 +83,24 @@ reducing the output size.
8483

8584
```@MirrorsUsed``` is often hard to get right as it really depends on how/if
8685
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:
8988

9089
```
9190
@MirrorsUsed(
92-
targets: const [
93-
'angular.core',
94-
'angular.core.dom',
95-
'angular.core.parser',
96-
'angular.routing',
97-
'NodeTreeSanitizer'
98-
],
9991
metaTargets: const [
100-
NgInjectableService,
101-
NgComponent,
102-
NgDirective,
103-
NgController,
104-
NgFilter,
105-
NgAttr,
106-
NgOneWay,
107-
NgOneWayOneTime,
108-
NgTwoWay,
109-
NgCallback
92+
NgFilter
11093
],
11194
override: '*'
11295
)
11396
import 'dart:mirrors';
11497
```
11598

11699
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.)
121104

122105
### Debugging
123106

@@ -319,7 +302,7 @@ or the debug version:
319302
<script src="packages/shadow_dom/shadow_dom.debug.js"></script>
320303
```
321304

322-
**NOTE:** using the polyfill has [some limitations][shadowdom-limitations],
305+
**NOTE:** Using the polyfill has [some limitations][shadowdom-limitations],
323306
so make sure you are aware of those limitations before you start using it.
324307

325308
[dart-mirrors-api]: https://api.dartlang.org/docs/channels/stable/latest/dart_mirrors.html

0 commit comments

Comments
 (0)