Packages > @fluidframework/tree > ITree

ITree Interface

Channel for a Fluid Tree DDS.

Signature

/** @sealed */
export interface ITree extends IFluidLoadable

Extends: IFluidLoadable

Remarks

Allows storing and collaboratively editing schema-aware hierarchial data.

Methods

Method Return Type Description
viewWith(config) TreeView<TRoot> Returns a TreeView using the provided schema. If the stored schema is compatible with the view schema specified by config, the returned TreeView will expose the root with a schema-aware API based on the provided view schema. If the provided schema is incompatible with the stored schema, the view will instead expose a status indicating the incompatibility.

Method Details

viewWith

Returns a TreeView using the provided schema. If the stored schema is compatible with the view schema specified by config, the returned TreeView will expose the root with a schema-aware API based on the provided view schema. If the provided schema is incompatible with the stored schema, the view will instead expose a status indicating the incompatibility.

Signature

viewWith<TRoot extends ImplicitFieldSchema>(config: TreeViewConfiguration<TRoot>): TreeView<TRoot>;
Type Parameters
Parameter Constraint Description
TRoot ImplicitFieldSchema

Remarks

If the tree is uninitialized (has no schema and no content), use initialize(content) on the returned view to set the schema and content together. Using viewWith followed by upgradeSchema() to initialize only the schema for a document is technically valid when the schema permits trees with no content.

Note that other clients can modify the document at any time, causing the view to change its compatibility status: see events for how to handle invalidation in these cases.

Only one schematized view may exist for a given ITree at a time. If creating a second, the first must be disposed before calling viewWith again.

Parameters

Parameter Type Description
config TreeViewConfiguration<TRoot>

Returns

Return type: TreeView <TRoot>