refactor(core): change bootstrap of modules and names of platforms

BREAKING CHANGES:
- `browserPlatform`/`browserDynamicPlatform`/... have been deprecated and renamed into `platformBrowser`/`platformBrowserDynamic`/....
- `bootstrapModule` and `bootstrapModuleFactory` have been moved to be members of `PlaformRef`.
  E.g. `platformBrowserDynamic().bootstrapModule(MyModule)`.
This commit is contained in:
Tobias Bosch
2016-07-26 05:21:19 -07:00
parent 00b726f695
commit 5a21f168d6
27 changed files with 219 additions and 163 deletions

View File

@ -7,7 +7,7 @@
*/
import {CommonModule, PlatformLocation} from '@angular/common';
import {ApplicationModule, ExceptionHandler, NgModule, NgModuleFactory, NgModuleRef, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, SanitizationService, Testability, assertPlatform, corePlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode} from '@angular/core';
import {ApplicationModule, ExceptionHandler, NgModule, NgModuleFactory, NgModuleRef, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, SanitizationService, Testability, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode, platformCore} from '@angular/core';
import {wtfInit} from '../core_private';
import {AnimationDriver} from '../src/dom/animation_driver';
@ -38,8 +38,8 @@ export const INTERNAL_BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider |
*
* Used automatically by `bootstrap`, or can be passed to `platform`.
*
* @deprecated Use `browserPlatform()` or create a custom platform factory via
* `createPlatformFactory(browserPlatform, ...)`
* @deprecated Use `platformBrowser()` or create a custom platform factory via
* `createPlatformFactory(platformBrowser, ...)`
*/
export const BROWSER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
[PLATFORM_COMMON_PROVIDERS, INTERNAL_BROWSER_PLATFORM_PROVIDERS];
@ -71,8 +71,13 @@ export const BROWSER_APP_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [];
/**
* @experimental API related to bootstrapping are still under review.
*/
export const browserPlatform =
createPlatformFactory(corePlatform, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
export const platformBrowser =
createPlatformFactory(platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
/**
* @deprecated Use {@link platformBrowser} instead
*/
export const browserPlatform = platformBrowser;
export function initDomAdapter() {
BrowserDomAdapter.makeCurrent();

View File

@ -7,7 +7,7 @@
*/
import {CommonModule, FORM_PROVIDERS} from '@angular/common';
import {APP_INITIALIZER, ApplicationModule, ExceptionHandler, NgModule, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PlatformRef, ReflectiveInjector, RootRenderer, assertPlatform, corePlatform, createPlatform, createPlatformFactory, getPlatform} from '@angular/core';
import {APP_INITIALIZER, ApplicationModule, ExceptionHandler, NgModule, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PlatformRef, ReflectiveInjector, RootRenderer, assertPlatform, createPlatform, createPlatformFactory, getPlatform, platformCore} from '@angular/core';
import {BROWSER_SANITIZATION_PROVIDERS} from './browser';
import {isBlank, print} from './facade/lang';
@ -29,8 +29,8 @@ class PrintLogger {
}
/**
* @deprecated Use `workerAppPlatform()` or create a custom platform factory via
* `createPlatformFactory(workerAppPlatform, ...)`
* @deprecated Use `platformWorkerApp()` or create a custom platform factory via
* `createPlatformFactory(platformWorkerApp, ...)`
*/
export const WORKER_APP_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
PLATFORM_COMMON_PROVIDERS;
@ -46,7 +46,12 @@ export const WORKER_APP_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any
/**
* @experimental
*/
export const workerAppPlatform = createPlatformFactory(corePlatform, 'workerApp');
export const platformWorkerApp = createPlatformFactory(platformCore, 'workerApp');
/**
* @deprecated Use {@link platformWorkerApp} instead
*/
export const workerAppPlatform = platformWorkerApp;
function _exceptionHandler(): ExceptionHandler {
return new ExceptionHandler(new PrintLogger());

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {ExceptionHandler, Injectable, Injector, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, Testability, assertPlatform, corePlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode} from '@angular/core';
import {ExceptionHandler, Injectable, Injector, NgZone, OpaqueToken, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, PlatformRef, ReflectiveInjector, RootRenderer, Testability, assertPlatform, createPlatform, createPlatformFactory, getPlatform, isDevMode, platformCore} from '@angular/core';
import {wtfInit} from '../core_private';
@ -107,8 +107,8 @@ export const _WORKER_UI_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*
];
/**
* * @deprecated Use `workerUiPlatform()` or create a custom platform factory via
* `createPlatformFactory(workerUiPlatform, ...)`
* * @deprecated Use `platformWorkerUi()` or create a custom platform factory via
* `createPlatformFactory(platformWorkerUi, ...)`
*/
export const WORKER_UI_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
[PLATFORM_COMMON_PROVIDERS, _WORKER_UI_PLATFORM_PROVIDERS];
@ -155,8 +155,14 @@ function initWebWorkerRenderPlatform(injector: Injector): () => void {
/**
* @experimental WebWorker support is currently experimental.
*/
export const workerUiPlatform =
createPlatformFactory(corePlatform, 'workerUi', _WORKER_UI_PLATFORM_PROVIDERS);
export const platformWorkerUi =
createPlatformFactory(platformCore, 'workerUi', _WORKER_UI_PLATFORM_PROVIDERS);
/**
* @deprecated Use {@link platformWorkerUi} instead
*/
export const workerUiPlatform = platformWorkerUi;
function _exceptionHandler(): ExceptionHandler {
return new ExceptionHandler(getDOM());