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();