@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
60 lines (59 loc) • 2.1 kB
TypeScript
import { Observable } from 'rxjs';
import { ExtensionBroker } from './extension-broker';
import { WorkerExtensionInstance } from './model/extension-instance';
export declare type WorkerVersionArgumentMapper = (method: string, version: number, args: any) => any[];
export interface WorkerResult<T> {
returnValue?: T;
error?: any;
worker: WorkerExtensionInstance;
}
/**
* Defines an abstraction for working with a set of workers given a designated extension target
*/
export declare class WorkerSet {
private extensionBroker;
private extensionTarget;
private mapArguments?;
/**
* The source name to use when logging about this service
*/
private get logSourceName();
/**
* Observable to track the creation of our workers
*/
private workers;
/**
* Determine if workers were initialized successfully
*/
private workersInitializedSubject;
readonly workersInitialized: Observable<boolean>;
get isWorkersInitialized(): boolean;
/**
* instantiates a new instance of the AzureCenterService service
* @param extensionBroker the extension broker instance
* @param extensionTarget the extension target id we want to get workers for
* @param mapArguments a function that maps different versions of worker arguments
* based on the the versions implemented by a worker @optional @deprecated
*/
constructor(extensionBroker: ExtensionBroker, extensionTarget: string, mapArguments?: WorkerVersionArgumentMapper);
/**
* Initializes the workers
*/
initializeWorkers(): void;
/**
* Destroys the workers
*/
destroyWorkers(): void;
/**
* Calls a method on each worker in and emits when all workers to respond
*/
all<T>(method: string, ...args: any[]): Observable<WorkerResult<T>[]>;
/**
* Calls a method on each worker in and emits when each worker responds
*/
each<T>(method: string, ...args: any[]): Observable<WorkerResult<T>>;
/**
* Calls a function on the applicable workers
*/
private prepareCalls;
}