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 * 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 * (representing the `<title>` tag). Instead, this service can be used to set and get the current
* title value. * title value.
*
* @experimental
*/ */
export class Title { export class Title {
/** /**

View File

@ -7,6 +7,9 @@ import {DateWrapper, StringWrapper, isPresent, print, stringify} from '../../fac
import {MessageBus} from './message_bus'; import {MessageBus} from './message_bus';
import {Serializer} from './serializer'; import {Serializer} from './serializer';
/**
* @experimental
*/
export abstract class ClientMessageBrokerFactory { export abstract class ClientMessageBrokerFactory {
/** /**
* Initializes the given channel and attaches a new {@link ClientMessageBroker} to it. * 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 { export abstract class ClientMessageBroker {
abstract runOnService(args: UiArguments, returnType: Type): Promise<any>; abstract runOnService(args: UiArguments, returnType: Type): Promise<any>;
} }
@ -148,10 +154,16 @@ class MessageData {
} }
} }
/**
* @experimental
*/
export class FnArg { export class FnArg {
constructor(public value: any /** TODO #9100 */, public type: Type) {} constructor(public value: any /** TODO #9100 */, public type: Type) {}
} }
/**
* @experimental
*/
export class UiArguments { export class UiArguments {
constructor(public method: string, public args?: FnArg[]) {} 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 * Communication is based on a channel abstraction. Messages published in a
* given channel to one MessageBusSink are received on the same channel * given channel to one MessageBusSink are received on the same channel
* by the corresponding MessageBusSource. * by the corresponding MessageBusSource.
* @experimental
*/ */
export abstract class MessageBus implements MessageBusSource, MessageBusSink { export abstract class MessageBus implements MessageBusSource, MessageBusSink {
/** /**
@ -41,6 +42,9 @@ export abstract class MessageBus implements MessageBusSource, MessageBusSink {
abstract to(channel: string): EventEmitter<any>; abstract to(channel: string): EventEmitter<any>;
} }
/**
* @experimental
*/
export interface MessageBusSource { export interface MessageBusSource {
/** /**
* Sets up a new channel on the MessageBusSource. * Sets up a new channel on the MessageBusSource.
@ -64,6 +68,9 @@ export interface MessageBusSource {
from(channel: string): EventEmitter<any>; from(channel: string): EventEmitter<any>;
} }
/**
* @experimental
*/
export interface MessageBusSink { export interface MessageBusSink {
/** /**
* Sets up a new channel on the 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) // 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. // We set it to String so that it is considered a Type.
/**
* @experimental
*/
export const PRIMITIVE: Type = String; export const PRIMITIVE: Type = String;
@Injectable() @Injectable()

View File

@ -29,6 +29,9 @@ export class ServiceMessageBrokerFactory_ extends ServiceMessageBrokerFactory {
} }
} }
/**
* @experimental
*/
export abstract class ServiceMessageBroker { export abstract class ServiceMessageBroker {
abstract registerMethod( abstract registerMethod(
methodName: string, signature: Type[], method: Function, returnType?: Type): void; methodName: string, signature: Type[], method: Function, returnType?: Type): void;
@ -88,6 +91,9 @@ export class ServiceMessageBroker_ extends ServiceMessageBroker {
} }
} }
/**
* @experimental
*/
export class ReceivedMessage { export class ReceivedMessage {
method: string; method: string;
args: any[]; 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 * 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. * include these providers when setting up the render thread.
* @experimental
*/ */
export const WORKER_UI_LOCATION_PROVIDERS = [ export const WORKER_UI_LOCATION_PROVIDERS = [
MessageBasedPlatformLocation, BrowserPlatformLocation, 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 * Those providers should be added when the router is used in a worker context in addition to the
* {@link ROUTER_PROVIDERS} and after them. * {@link ROUTER_PROVIDERS} and after them.
* @experimental
*/ */
export const WORKER_APP_LOCATION_PROVIDERS = [ export const WORKER_APP_LOCATION_PROVIDERS = [
{provide: PlatformLocation, useClass: WebWorkerPlatformLocation}, { {provide: PlatformLocation, useClass: WebWorkerPlatformLocation}, {

View File

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