fix(core): Document the new bootstrap APIs. Also rename rootBindings() to platformBindings() to be more clear about what it is.
Closes #4218
This commit is contained in:
@ -36,6 +36,42 @@ import {WebWorkerEventDispatcher} from 'angular2/src/web_workers/worker/event_di
|
||||
import {ComponentRef} from 'angular2/src/core/compiler/dynamic_component_loader';
|
||||
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||
|
||||
/**
|
||||
* Initialize the Angular 'platform' on the page in a manner suitable for applications
|
||||
* running in a web worker. Applications running on a web worker do not have direct
|
||||
* access to DOM APIs.
|
||||
*
|
||||
* See {@link PlatformRef} for details on the Angular platform.
|
||||
*
|
||||
* # Without specified bindings
|
||||
*
|
||||
* If no bindings are specified, `platform`'s behavior depends on whether an existing
|
||||
* platform exists:
|
||||
*
|
||||
* If no platform exists, a new one will be created with the default {@link platformBindings}.
|
||||
*
|
||||
* If a platform already exists, it will be returned (regardless of what bindings it
|
||||
* was created with). This is a convenience feature, allowing for multiple applications
|
||||
* to be loaded into the same platform without awareness of each other.
|
||||
*
|
||||
* # With specified bindings
|
||||
*
|
||||
* It is also possible to specify bindings to be made in the new platform. These bindings
|
||||
* will be shared between all applications on the page. For example, an abstraction for
|
||||
* the browser cookie jar should be bound at the platform level, because there is only one
|
||||
* cookie jar regardless of how many applications on the age will be accessing it.
|
||||
*
|
||||
* If bindings are specified directly, `platform` will create the Angular platform with
|
||||
* them if a platform did not exist already. If it did exist, however, an error will be
|
||||
* thrown.
|
||||
*
|
||||
* # For Web Worker Appplications
|
||||
*
|
||||
* This version of `platform` initializes Angular for use with applications
|
||||
* that do not directly touch the DOM, such as applications which run in a
|
||||
* web worker context. Applications that need direct access to the DOM should
|
||||
* use `platform` from `core/application_common` instead.
|
||||
*/
|
||||
export function platform(bindings?: Array<Type | Binding | any[]>): PlatformRef {
|
||||
return platformCommon(bindings);
|
||||
}
|
||||
|
Reference in New Issue
Block a user