docs: update api ref doc for platform browser (#37186)

Edit descriptions, usage examples, and add links to be complete and consistent with API reference doc style

PR Close #37186
This commit is contained in:
Judy Bogart
2020-05-18 11:45:49 -07:00
committed by Misko Hevery
parent bf682d73d4
commit 886e3ebcca
3 changed files with 97 additions and 19 deletions

View File

@ -135,7 +135,7 @@ export class NgProbeToken {
/**
* Creates a platform.
* Platforms have to be eagerly created via this function.
* Platforms must be created on launch using this function.
*
* @publicApi
*/
@ -153,7 +153,13 @@ export function createPlatform(injector: Injector): PlatformRef {
}
/**
* Creates a factory for a platform
* Creates a factory for a platform. Can be used to provide or override `Providers` specific to
* your applciation's runtime needs, such as `PLATFORM_INITIALIZER` and `PLATFORM_ID`.
* @param parentPlatformFactory Another platform factory to modify. Allows you to compose factories
* to build up configurations that might be required by different libraries or parts of the
* application.
* @param name Identifies the new platform factory.
* @param providers A set of dependency providers for platforms created with the new factory.
*
* @publicApi
*/
@ -182,7 +188,7 @@ export function createPlatformFactory(
}
/**
* Checks that there currently is a platform which contains the given token as a provider.
* Checks that there is currently a platform that contains the given token as a provider.
*
* @publicApi
*/
@ -202,7 +208,8 @@ export function assertPlatform(requiredToken: any): PlatformRef {
}
/**
* Destroy the existing platform.
* Destroys the current Angular platform and all Angular applications on the page.
* Destroys all modules and listeners registered with the platform.
*
* @publicApi
*/
@ -259,12 +266,11 @@ export interface BootstrapOptions {
}
/**
* The Angular platform is the entry point for Angular on a web page. Each page
* has exactly one platform, and services (such as reflection) which are common
* The Angular platform is the entry point for Angular on a web page.
* Each page has exactly one platform. Services (such as reflection) which are common
* to every Angular application running on the page are bound in its scope.
*
* A page's platform is initialized implicitly when a platform is created via a platform factory
* (e.g. {@link platformBrowser}), or explicitly by calling the {@link createPlatform} function.
* A page's platform is initialized implicitly when a platform is created using a platform
* factory such as `PlatformBrowser`, or explicitly by calling the `createPlatform()` function.
*
* @publicApi
*/
@ -278,11 +284,11 @@ export class PlatformRef {
constructor(private _injector: Injector) {}
/**
* Creates an instance of an `@NgModule` for the given platform
* for offline compilation.
* Creates an instance of an `@NgModule` for the given platform for offline compilation.
*
* @usageNotes
* ### Simple Example
*
* The following example creates the NgModule for a browser platform.
*
* ```typescript
* my_module.ts:
@ -384,14 +390,14 @@ export class PlatformRef {
}
/**
* Register a listener to be called when the platform is disposed.
* Registers a listener to be called when the platform is destroyed.
*/
onDestroy(callback: () => void): void {
this._destroyListeners.push(callback);
}
/**
* Retrieve the platform {@link Injector}, which is the parent injector for
* Retrieves the platform {@link Injector}, which is the parent injector for
* every Angular application on the page and provides singleton providers.
*/
get injector(): Injector {
@ -399,7 +405,8 @@ export class PlatformRef {
}
/**
* Destroy the Angular platform and all Angular applications on the page.
* Destroys the current Angular platform and all Angular applications on the page.
* Destroys all modules and listeners registered with the platform.
*/
destroy() {
if (this._destroyed) {