refactor(core): support non reflective bootstrap.
This changes Angular so that it can be used without reflection (assuming a codegen for injectors). BREAKIKNG CHANGE: - Drops `APP_COMPONENT` provider. Instead, inject `ApplicationRef` and read its `componentTypes` property. - long form bootstrap has changed into the following: ``` var platform = createPlatform(ReflectiveInjector.resolveAndCreate(BROWSER_PROVIDERS)); var appInjector = ReflectiveInjector.resolveAndCreate([BROWSER_APP_PROVIDERS, appProviders], platform.injector); coreLoadAndBootstrap(appInjector, MyApp); ```
This commit is contained in:
@ -9,12 +9,5 @@ import "package:angular2/src/web_workers/worker/router_providers.dart";
|
||||
|
||||
@AngularEntrypoint()
|
||||
main(List<String> args, SendPort replyTo) {
|
||||
platform([
|
||||
WORKER_APP_PLATFORM,
|
||||
new Provider(RENDER_SEND_PORT, useValue: replyTo)
|
||||
]).asyncApplication(null, [
|
||||
WORKER_APP_APPLICATION,
|
||||
WORKER_APP_ROUTER,
|
||||
new Provider(LocationStrategy, useClass: HashLocationStrategy)
|
||||
]).then((ref) => ref.bootstrap(App));
|
||||
bootstrapApp(replyTo, App, [WORKER_APP_ROUTER, new Provider(LocationStrategy, useClass: HashLocationStrategy)]);
|
||||
}
|
||||
|
@ -1,18 +1,9 @@
|
||||
import {platform, Provider, NgZone} from "angular2/core";
|
||||
import {Provider} from "angular2/core";
|
||||
import {bootstrapApp, WORKER_APP_ROUTER} from "angular2/platform/worker_app";
|
||||
import {HashLocationStrategy, LocationStrategy} from 'angular2/platform/common';
|
||||
import {
|
||||
WORKER_APP_PLATFORM,
|
||||
WORKER_APP_APPLICATION,
|
||||
WORKER_APP_ROUTER
|
||||
} from "angular2/platform/worker_app";
|
||||
import {App} from "./index_common";
|
||||
|
||||
export function main() {
|
||||
let refPromise = platform([WORKER_APP_PLATFORM])
|
||||
.asyncApplication(null, [
|
||||
WORKER_APP_APPLICATION,
|
||||
WORKER_APP_ROUTER,
|
||||
new Provider(LocationStrategy, {useClass: HashLocationStrategy})
|
||||
]);
|
||||
refPromise.then((ref) => ref.bootstrap(App));
|
||||
bootstrapApp(
|
||||
App, [WORKER_APP_ROUTER, new Provider(LocationStrategy, {useClass: HashLocationStrategy})]);
|
||||
}
|
||||
|
@ -8,6 +8,5 @@ import "package:angular2/src/core/reflection/reflection.dart";
|
||||
@AngularEntrypoint()
|
||||
main() {
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
platform([WORKER_RENDER_PLATFORM]).asyncApplication(
|
||||
initIsolate("background_index.dart"), [WORKER_RENDER_ROUTER]);
|
||||
bootstrapRender("background_index.dart", WORKER_RENDER_ROUTER);
|
||||
}
|
||||
|
@ -1,15 +1,5 @@
|
||||
import {platform, Provider} from 'angular2/core';
|
||||
import {
|
||||
WORKER_RENDER_APP,
|
||||
WORKER_RENDER_PLATFORM,
|
||||
WORKER_SCRIPT,
|
||||
WORKER_RENDER_ROUTER
|
||||
} from 'angular2/platform/worker_render';
|
||||
import {Provider} from 'angular2/core';
|
||||
import {bootstrapRender, WORKER_RENDER_ROUTER} from 'angular2/platform/worker_render';
|
||||
import {MessageBasedPlatformLocation} from "angular2/src/web_workers/ui/platform_location";
|
||||
|
||||
let ref = platform([WORKER_RENDER_PLATFORM])
|
||||
.application([
|
||||
WORKER_RENDER_APP,
|
||||
new Provider(WORKER_SCRIPT, {useValue: "loader.js"}),
|
||||
WORKER_RENDER_ROUTER
|
||||
]);
|
||||
let ref = bootstrapRender("loader.js", WORKER_RENDER_ROUTER);
|
||||
|
Reference in New Issue
Block a user