X Tutup
Skip to content

Commit 6b2ef25

Browse files
Tim Blasivsavkin
authored andcommitted
feat(dart/transform): Introduce @AngularEntrypoint()
1 parent 3e364b0 commit 6b2ef25

File tree

7 files changed

+34
-5
lines changed

7 files changed

+34
-5
lines changed

modules/angular2/angular2.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ export 'package:angular2/core.dart'
99
hide forwardRef, resolveForwardRef, ForwardRefFn;
1010
export 'package:angular2/common.dart';
1111
export 'package:angular2/instrumentation.dart';
12+
export 'package:angular2/src/core/angular_entrypoint.dart' show AngularEntrypoint;
1213
export 'package:angular2/src/core/application_tokens.dart'
1314
hide APP_COMPONENT_REF_PROMISE, APP_ID_RANDOM_PROVIDER;
1415
export 'package:angular2/src/platform/dom/dom_tokens.dart';
1516
export 'package:angular2/src/platform/dom/dom_adapter.dart';
1617
export 'package:angular2/src/platform/dom/events/event_manager.dart';
1718
export 'package:angular2/src/compiler/url_resolver.dart';
18-
export 'package:angular2/src/compiler/app_root_url.dart';
19+
export 'package:angular2/src/compiler/app_root_url.dart';

modules/angular2/bootstrap.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
* @deprecated
44
*/
55
export {bootstrap} from 'angular2/platform/browser';
6+
export {AngularEntrypoint} from 'angular2/src/core/angular_entrypoint';

modules/angular2/bootstrap_static.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
* @deprecated
44
*/
55
export {bootstrapStatic} from 'angular2/platform/browser_static';
6+
export {AngularEntrypoint} from 'angular2/src/core/angular_entrypoint';

modules/angular2/platform/browser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export {AngularEntrypoint} from 'angular2/src/core/angular_entrypoint';
12
export {
23
BROWSER_PROVIDERS,
34
ELEMENT_PROBE_BINDINGS,
@@ -124,4 +125,4 @@ export function bootstrap(
124125
let appProviders =
125126
isPresent(customProviders) ? [BROWSER_APP_PROVIDERS, customProviders] : BROWSER_APP_PROVIDERS;
126127
return platform(BROWSER_PROVIDERS).application(appProviders).bootstrap(appComponentType);
127-
}
128+
}

modules/angular2/platform/browser_static.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export {AngularEntrypoint} from 'angular2/src/core/angular_entrypoint';
12
export {
23
BROWSER_PROVIDERS,
34
ELEMENT_PROBE_BINDINGS,
@@ -10,13 +11,13 @@ export {
1011
disableDebugTools
1112
} from 'angular2/src/platform/browser_common';
1213

13-
import {Type, isPresent, CONST_EXPR} from 'angular2/src/facade/lang';
14+
import {Type, isPresent} from 'angular2/src/facade/lang';
1415
import {Promise} from 'angular2/src/facade/promise';
1516
import {
1617
BROWSER_PROVIDERS,
1718
BROWSER_APP_COMMON_PROVIDERS
1819
} from 'angular2/src/platform/browser_common';
19-
import {ComponentRef, platform, reflector} from 'angular2/core';
20+
import {ComponentRef, platform} from 'angular2/core';
2021

2122
/**
2223
* An array of providers that should be passed into `application()` when bootstrapping a component
@@ -39,4 +40,4 @@ export function bootstrapStatic(appComponentType: Type,
3940
let appProviders =
4041
isPresent(customProviders) ? [BROWSER_APP_PROVIDERS, customProviders] : BROWSER_APP_PROVIDERS;
4142
return platform(BROWSER_PROVIDERS).application(appProviders).bootstrap(appComponentType);
42-
}
43+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import {CONST} from 'angular2/src/facade/lang';
2+
3+
/**
4+
* Marks a function or method as an Angular 2 entrypoint. Only necessary in Dart code.
5+
*
6+
* The optional `name` parameter will be reflected in logs when the entry point is processed.
7+
*
8+
* See [the wiki][] for detailed documentation.
9+
* [the wiki]: https://github.com/angular/angular/wiki/Angular-2-Dart-Transformer#entry_points
10+
*
11+
* ## Example
12+
*
13+
* ```
14+
* @AngularEntrypoint("name-for-debug")
15+
* void main() {
16+
* bootstrap(MyComponent);
17+
* }
18+
*/
19+
@CONST()
20+
export class AngularEntrypoint {
21+
constructor(public name?: String) {}
22+
}

modules/angular2/test/public_api_spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ var NG_ALL = [
7676
'AbstractControlDirective.valid',
7777
'AbstractControlDirective.value',
7878
'AbstractControlDirective.path',
79+
'AngularEntrypoint',
80+
'AngularEntrypoint.name',
7981
'AppRootUrl',
8082
'AppRootUrl.value',
8183
'AppRootUrl.value=',

0 commit comments

Comments
 (0)
X Tutup