Skip to content 

IFluidDependencySynthesizer Interface

Packages > @fluidframework/synthesize > IFluidDependencySynthesizer

IFluidDependencySynthesizer can generate IFluidObjects based on the IProvideFluidObject pattern. It allow for registering providers and uses synthesize to generate a new object with the optional and required types.

Signature:

export interface IFluidDependencySynthesizer extends IProvideFluidDependencySynthesizer 

Extends: IProvideFluidDependencySynthesizer

Properties

List of properties of this interface
Property Type Description
registeredTypes Iterable<(keyof IFluidObject)> All the registered types available

Methods

List of methods of this class
Method Description
getProvider(type) Get a provider. undefined if not available.
has(types) Check if a given type is registered
register(type, provider) Add a new provider
synthesize(optionalTypes, requiredTypes) synthesize takes optional and required types and returns an object that will fulfill the defined types based off objects that has been previously registered.
unregister(type) Remove a provider

Events

registeredTypes

All the registered types available

Signature:

readonly registeredTypes: Iterable<(keyof IFluidObject)>;

Methods

getProvider

Get a provider. undefined if not available.

Signature:

getProvider<T extends keyof IFluidObject>(type: T): FluidObjectProvider<T> | undefined;

Parameters

List of parameters
Parameter Type Description
type T Type to get

Returns:

FluidObjectProvider<T> | undefined

has

Check if a given type is registered

Signature:

has(...types: (keyof IFluidObject)[]): boolean;

Parameters

List of parameters
Parameter Type Description
types (keyof IFluidObject)[] Type to check

Returns:

boolean

register

Add a new provider

Signature:

register<T extends keyof IFluidObject>(type: T, provider: FluidObjectProvider<T>): void;

Parameters

List of parameters
Parameter Type Description
type T Name of the Type T being provided
provider FluidObjectProvider A provider that will resolve the T correctly when asked

Returns:

void

Exceptions

  • If passing a type that’s already registered

synthesize

synthesize takes optional and required types and returns an object that will fulfill the defined types based off objects that has been previously registered.

Signature:

synthesize<O extends IFluidObject, R extends IFluidObject>(optionalTypes: FluidObjectSymbolProvider<O>, requiredTypes: FluidObjectSymbolProvider<R>): AsyncFluidObjectProvider<FluidObjectKey<O>, FluidObjectKey<R>>;

Parameters

List of parameters
Parameter Type Description
optionalTypes FluidObjectSymbolProvider optional types to be in the Scope object
requiredTypes FluidObjectSymbolProvider required types that need to be in the Scope object

Returns:

AsyncFluidObjectProvider<FluidObjectKey<O>, FluidObjectKey<R>>

unregister

Remove a provider

Signature:

unregister<T extends keyof IFluidObject>(type: T): void;

Parameters

List of parameters
Parameter Type Description
type T Name of the provider to remove

Returns:

void