Skip to main content
Version: v1

@fluidframework/dds-interceptions Package

Functions

FunctionReturn TypeDescription
createDirectoryWithInterception(baseDirectory, context, setInterceptionCallback)T
  • Create a new object from the passed IDirectory object. - Modify the set method to call the setInterceptionCallback before calling set on the underlying object. - The setInterceptionCallback and the call to the underlying object are wrapped around an orderSequentially call to batch any operations that might happen in the callback. - Modify the sub directory methods to create / return a wrapper object that in turn intercepts the set method and calls the setInterceptionCallback. - When a sub directory is created from this directory, this directory object is passed to it which is passed into the interception callback.
createSharedMapWithInterception(sharedMap, context, setInterceptionCallback)SharedMap
  • Create a new object from the passed SharedMap. - Modify the set method to call the setInterceptionCallback before calling set on the underlying SharedMap. - The setInterceptionCallback and the call to the underlying SharedMap are wrapped around an orderSequentially call to batch any operations that might happen in the callback.
createSharedStringWithInterception(sharedString, context, propertyInterceptionCallback)SharedString
  • Create a new object from the passed SharedString. - Modify the methods that insert / remove / annotate the properties of the SharedString to call the propertyInterceptionCallback to get new properties. - Use these new properties to call the underlying SharedString. - The propertyInterceptionCallback and the call to the underlying SharedString are wrapped around an orderSequentially call to batch any operations that might happen in the callback.

Function Details

createDirectoryWithInterception

  • Create a new object from the passed IDirectory object. - Modify the set method to call the setInterceptionCallback before calling set on the underlying object. - The setInterceptionCallback and the call to the underlying object are wrapped around an orderSequentially call to batch any operations that might happen in the callback. - Modify the sub directory methods to create / return a wrapper object that in turn intercepts the set method and calls the setInterceptionCallback. - When a sub directory is created from this directory, this directory object is passed to it which is passed into the interception callback.

Signature

export declare function createDirectoryWithInterception<T extends IDirectory>(baseDirectory: T, context: IFluidDataStoreContext, setInterceptionCallback: (baseDirectory: IDirectory, subDirectory: IDirectory, key: string, value: any) => void): T;
Type Parameters
ParameterConstraintDescription
TIDirectory

Parameters

ParameterTypeDescription
baseDirectoryTThe underlying object that is to be intercepted
contextIFluidDataStoreContextThe IFluidDataStoreContext that will be used to call orderSequentially
setInterceptionCallback(baseDirectory: IDirectory, subDirectory: IDirectory, key: string, value: any) => voidThe interception callback to be called

Returns

A new IDirectory object that intercepts the set method and calls the setInterceptionCallback.

Return type: T

createSharedMapWithInterception

  • Create a new object from the passed SharedMap. - Modify the set method to call the setInterceptionCallback before calling set on the underlying SharedMap. - The setInterceptionCallback and the call to the underlying SharedMap are wrapped around an orderSequentially call to batch any operations that might happen in the callback.

Signature

export declare function createSharedMapWithInterception(sharedMap: SharedMap, context: IFluidDataStoreContext, setInterceptionCallback: (sharedMap: ISharedMap, key: string, value: any) => void): SharedMap;

Parameters

ParameterTypeDescription
sharedMapSharedMapThe underlying SharedMap
contextIFluidDataStoreContextThe IFluidDataStoreContext that will be used to call orderSequentially
setInterceptionCallback(sharedMap: ISharedMap, key: string, value: any) => voidThe interception callback to be called

Returns

A new SharedMap that intercepts the set method and calls the setInterceptionCallback.

Return type: SharedMap

createSharedStringWithInterception

  • Create a new object from the passed SharedString. - Modify the methods that insert / remove / annotate the properties of the SharedString to call the propertyInterceptionCallback to get new properties. - Use these new properties to call the underlying SharedString. - The propertyInterceptionCallback and the call to the underlying SharedString are wrapped around an orderSequentially call to batch any operations that might happen in the callback.

Signature

export declare function createSharedStringWithInterception(sharedString: SharedString, context: IFluidDataStoreContext, propertyInterceptionCallback: (props?: MergeTree.PropertySet) => MergeTree.PropertySet): SharedString;

Parameters

ParameterTypeDescription
sharedStringSharedStringThe underlying SharedString
contextIFluidDataStoreContextThe IFluidDataStoreContext that will be used to call orderSequentially
propertyInterceptionCallback(props?: MergeTree.PropertySet) => MergeTree.PropertySetThe interception callback to be called

Returns

A new SharedString that intercepts the methods modifying the SharedString properties.

Return type: SharedString