@fluidframework/dds-interceptions Package
Functions
Function | Return Type | Description |
---|---|---|
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
Parameter | Constraint | Description |
---|---|---|
T | IDirectory |
Parameters
Parameter | Type | Description |
---|---|---|
baseDirectory | T | The underlying object that is to be intercepted |
context | IFluidDataStoreContext | The IFluidDataStoreContext that will be used to call orderSequentially |
setInterceptionCallback | (baseDirectory: IDirectory, subDirectory: IDirectory, key: string, value: any) => void | The 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
Parameter | Type | Description |
---|---|---|
sharedMap | SharedMap | The underlying SharedMap |
context | IFluidDataStoreContext | The IFluidDataStoreContext that will be used to call orderSequentially |
setInterceptionCallback | (sharedMap: ISharedMap, key: string, value: any) => void | The 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
Parameter | Type | Description |
---|---|---|
sharedString | SharedString | The underlying SharedString |
context | IFluidDataStoreContext | The IFluidDataStoreContext that will be used to call orderSequentially |
propertyInterceptionCallback | (props?: MergeTree.PropertySet) => MergeTree.PropertySet | The interception callback to be called |
Returns
A new SharedString that intercepts the methods modifying the SharedString properties.
Return type: SharedString