提交 3ccc7a9a 编写于 作者: J Joao Moreno

async data source can be sync

上级 75d5bc40
...@@ -468,7 +468,7 @@ export class AsyncDataTree<T extends NonNullable<any>, TFilterData = void> imple ...@@ -468,7 +468,7 @@ export class AsyncDataTree<T extends NonNullable<any>, TFilterData = void> imple
this._onDidChangeNodeState.fire(node); this._onDidChangeNodeState.fire(node);
}, _ => null); }, _ => null);
return this.dataSource.getChildren(node.element) return Promise.resolve(this.dataSource.getChildren(node.element))
.then(children => { .then(children => {
slowTimeout.cancel(); slowTimeout.cancel();
node.state = AsyncDataTreeNodeState.Loaded; node.state = AsyncDataTreeNodeState.Loaded;
......
...@@ -147,7 +147,7 @@ export interface ITreeNavigator<T> { ...@@ -147,7 +147,7 @@ export interface ITreeNavigator<T> {
export interface IAsyncDataSource<T extends NonNullable<any>> { export interface IAsyncDataSource<T extends NonNullable<any>> {
hasChildren(element: T | null): boolean; hasChildren(element: T | null): boolean;
getChildren(element: T | null): Promise<T[]>; getChildren(element: T | null): T[] | Promise<T[]>;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册