This change moves many APIs to the angular2/core export.
This change also automatically adds FORM_BINDINGS in
the application root injector.
BREAKING CHANGE:
Many dependencies that were previously exported from specific
APIs are now exported from angular2/core. Affected exports, which
should now be included from angular2/core include:
angular2/forms
angular2/di
angular2/directives
angular2/change_detection
angular2/bootstrap (except for dart users)
angular2/render
angular2/metadata
angular2/debug
angular2/pipes
Closes #3977
41 lines
1.6 KiB
TypeScript
41 lines
1.6 KiB
TypeScript
import {
|
|
PostMessageBus,
|
|
PostMessageBusSink,
|
|
PostMessageBusSource
|
|
} from 'angular2/src/web_workers/shared/post_message_bus';
|
|
import {Type, BaseException} from "angular2/src/core/facade/lang";
|
|
import {Binding, Injectable} from "angular2/src/core/di";
|
|
import {Map} from 'angular2/src/core/facade/collection';
|
|
import {Promise} from 'angular2/src/core/facade/async';
|
|
import {bootstrapWebWorkerCommon} from "angular2/src/web_workers/worker/application_common";
|
|
import {ApplicationRef} from "angular2/src/core/application_ref";
|
|
export * from "angular2/src/web_workers/shared/message_bus";
|
|
|
|
// TODO(jteplitz602) remove this and compile with lib.webworker.d.ts (#3492)
|
|
interface PostMessageInterface {
|
|
(message: any, transferrables?:[ArrayBuffer]): void;
|
|
}
|
|
var _postMessage: PostMessageInterface = <any>postMessage;
|
|
|
|
/**
|
|
* Bootstrapping a Webworker Application
|
|
*
|
|
* You instantiate the application side by calling bootstrapWebworker from your webworker index
|
|
* script.
|
|
* You can call bootstrapWebworker() exactly as you would call bootstrap() in a regular Angular
|
|
* application
|
|
* See the bootstrap() docs for more details.
|
|
*/
|
|
export function bootstrapWebWorker(
|
|
appComponentType: Type, componentInjectableBindings: Array<Type | Binding | any[]> = null):
|
|
Promise<ApplicationRef> {
|
|
var sink = new PostMessageBusSink({
|
|
postMessage:
|
|
(message: any, transferrables?:[ArrayBuffer]) => { _postMessage(message, transferrables); }
|
|
});
|
|
var source = new PostMessageBusSource();
|
|
var bus = new PostMessageBus(sink, source);
|
|
|
|
return bootstrapWebWorkerCommon(appComponentType, bus, componentInjectableBindings);
|
|
}
|