docs(webworkers): add experimental markers for all web worker public apis

This commit is contained in:
Igor Minar 2016-06-15 08:41:41 -07:00
parent 4fc37aeabd
commit 933f45ef31
9 changed files with 55 additions and 0 deletions

View File

@ -6,6 +6,8 @@ import {getDOM} from '../dom/dom_adapter';
* it is not possible to bind to the `text` property of the `HTMLTitleElement` elements
* (representing the `<title>` tag). Instead, this service can be used to set and get the current
* title value.
*
* @experimental
*/
export class Title {
/**

View File

@ -7,6 +7,9 @@ import {DateWrapper, StringWrapper, isPresent, print, stringify} from '../../fac
import {MessageBus} from './message_bus';
import {Serializer} from './serializer';
/**
* @experimental
*/
export abstract class ClientMessageBrokerFactory {
/**
* Initializes the given channel and attaches a new {@link ClientMessageBroker} to it.
@ -32,6 +35,9 @@ export class ClientMessageBrokerFactory_ extends ClientMessageBrokerFactory {
}
}
/**
* @experimental
*/
export abstract class ClientMessageBroker {
abstract runOnService(args: UiArguments, returnType: Type): Promise<any>;
}
@ -148,10 +154,16 @@ class MessageData {
}
}
/**
* @experimental
*/
export class FnArg {
constructor(public value: any /** TODO #9100 */, public type: Type) {}
}
/**
* @experimental
*/
export class UiArguments {
constructor(public method: string, public args?: FnArg[]) {}
}

View File

@ -8,6 +8,7 @@ import {EventEmitter} from '../../facade/async';
* Communication is based on a channel abstraction. Messages published in a
* given channel to one MessageBusSink are received on the same channel
* by the corresponding MessageBusSource.
* @experimental
*/
export abstract class MessageBus implements MessageBusSource, MessageBusSink {
/**
@ -41,6 +42,9 @@ export abstract class MessageBus implements MessageBusSource, MessageBusSink {
abstract to(channel: string): EventEmitter<any>;
}
/**
* @experimental
*/
export interface MessageBusSource {
/**
* Sets up a new channel on the MessageBusSource.
@ -64,6 +68,9 @@ export interface MessageBusSource {
from(channel: string): EventEmitter<any>;
}
/**
* @experimental
*/
export interface MessageBusSink {
/**
* Sets up a new channel on the MessageBusSink.

View File

@ -11,6 +11,9 @@ import {LocationType} from './serialized_types';
// PRIMITIVE is any type that does not need to be serialized (string, number, boolean)
// We set it to String so that it is considered a Type.
/**
* @experimental
*/
export const PRIMITIVE: Type = String;
@Injectable()

View File

@ -29,6 +29,9 @@ export class ServiceMessageBrokerFactory_ extends ServiceMessageBrokerFactory {
}
}
/**
* @experimental
*/
export abstract class ServiceMessageBroker {
abstract registerMethod(
methodName: string, signature: Type[], method: Function, returnType?: Type): void;
@ -88,6 +91,9 @@ export class ServiceMessageBroker_ extends ServiceMessageBroker {
}
}
/**
* @experimental
*/
export class ReceivedMessage {
method: string;
args: any[];

View File

@ -8,6 +8,7 @@ import {MessageBasedPlatformLocation} from './platform_location';
/**
* A list of {@link Provider}s. To use the router in a Worker enabled application you must
* include these providers when setting up the render thread.
* @experimental
*/
export const WORKER_UI_LOCATION_PROVIDERS = [
MessageBasedPlatformLocation, BrowserPlatformLocation,

View File

@ -7,6 +7,7 @@ import {WebWorkerPlatformLocation} from './platform_location';
/**
* Those providers should be added when the router is used in a worker context in addition to the
* {@link ROUTER_PROVIDERS} and after them.
* @experimental
*/
export const WORKER_APP_LOCATION_PROVIDERS = [
{provide: PlatformLocation, useClass: WebWorkerPlatformLocation}, {

View File

@ -22,9 +22,15 @@ class PrintLogger {
const WORKER_APP_PLATFORM_MARKER = new OpaqueToken('WorkerAppPlatformMarker');
/**
* @experimental
*/
export const WORKER_APP_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
[PLATFORM_COMMON_PROVIDERS, {provide: WORKER_APP_PLATFORM_MARKER, useValue: true}];
/**
* @experimental
*/
export const WORKER_APP_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
APPLICATION_COMMON_PROVIDERS, FORM_PROVIDERS, BROWSER_SANITIZATION_PROVIDERS, Serializer,
{provide: ClientMessageBrokerFactory, useClass: ClientMessageBrokerFactory_},
@ -36,6 +42,9 @@ export const WORKER_APP_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any
{provide: APP_INITIALIZER, useValue: setupWebWorker, multi: true}
];
/**
* @experimental
*/
export function workerAppPlatform(): PlatformRef {
if (isBlank(getPlatform())) {
createPlatform(ReflectiveInjector.resolveAndCreate(WORKER_APP_PLATFORM_PROVIDERS));

View File

@ -29,6 +29,7 @@ const WORKER_RENDER_PLATFORM_MARKER = new OpaqueToken('WorkerRenderPlatformMarke
/**
* Wrapper class that exposes the Worker
* and underlying {@link MessageBus} for lower level message passing.
* @experimental
*/
@Injectable()
export class WebWorkerInstance {
@ -42,6 +43,9 @@ export class WebWorkerInstance {
}
}
/**
* @experimental
*/
export const WORKER_SCRIPT: OpaqueToken = new OpaqueToken('WebWorkerScript');
/**
@ -49,15 +53,22 @@ export const WORKER_SCRIPT: OpaqueToken = new OpaqueToken('WebWorkerScript');
* created.
*
* TODO(vicb): create an interface for startable services to implement
* @experimental
*/
export const WORKER_UI_STARTABLE_MESSAGING_SERVICE =
new OpaqueToken('WorkerRenderStartableMsgService');
/**
* * @experimental
*/
export const WORKER_UI_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
PLATFORM_COMMON_PROVIDERS, {provide: WORKER_RENDER_PLATFORM_MARKER, useValue: true},
{provide: PLATFORM_INITIALIZER, useValue: initWebWorkerRenderPlatform, multi: true}
];
/**
* * @experimental
*/
export const WORKER_UI_APPLICATION_PROVIDERS: Array<any /*Type | Provider | any[]*/> = [
APPLICATION_COMMON_PROVIDERS,
MessageBasedRenderer,
@ -108,6 +119,9 @@ function initWebWorkerRenderPlatform(): void {
BrowserGetTestability.init();
}
/**
* * @experimental
*/
export function workerUiPlatform(): PlatformRef {
if (isBlank(getPlatform())) {
createPlatform(ReflectiveInjector.resolveAndCreate(WORKER_UI_PLATFORM_PROVIDERS));