aboutsummaryrefslogtreecommitdiff
path: root/vfs/vfs.ts
diff options
context:
space:
mode:
Diffstat (limited to 'vfs/vfs.ts')
-rw-r--r--vfs/vfs.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/vfs/vfs.ts b/vfs/vfs.ts
index f23f585..4a2d042 100644
--- a/vfs/vfs.ts
+++ b/vfs/vfs.ts
@@ -23,12 +23,9 @@ export interface Response {
export interface VfsOptions {
id: string
- is_editable: boolean
- ListNodes: () => Response
- GetNode: (path: string) => Response
- UpdateNode: (node: Node) => Response
- DeleteNode: (node: Node) => Response
+ ListNodes: () => IPathNode
+ OnClickNode(path: string): void
}
export class Vfs {
@@ -43,14 +40,18 @@ export class Vfs {
console.log("Vfs: element id", opts.id, "not found")
return
}
+ }
+
+ async init() {
+ if (!this.el) {
+ return
+ }
- let res = this.opts.ListNodes()
- if (res.code != 200) {
- console.log("Vfs: ListNodes: ", res.message)
+ let resPathNode = await this.opts.ListNodes()
+ if (!resPathNode) {
return
}
- let resPathNode = res.data as IPathNode
for (const key in resPathNode) {
const value = resPathNode[key] as IVfsNode
const node = new VfsNode(value, (node: VfsNode) => {
@@ -74,8 +75,7 @@ export class Vfs {
onClickNode(this: Vfs, node: VfsNode) {
if (!node.is_dir) {
- const res = this.opts.GetNode(node.path)
- console.log("GetNode: ", res)
+ this.opts.OnClickNode(node.path)
return
}
this.comPath.open(node)