open-tree-folder
Description
Fires when opening or closing a folder that has child foldersThe action is triggered inside the tree panel only.
Usage
"open-tree-folder": ({
id: string,
mode: boolean
}) => void | false;
Parameters
The callback of the open-tree-folder action takes an object with the following parameters:
id
- (required) the ID of a folder that is openedmode
- (required) defines whether a folder is opened (true) or closed (false)
Example
<script>
import { getData, getDrive } from "./common/data";
import { Filemanager } from "wx-svelte-filemanager";
let api;
$: if (api) {
api.on("open-tree-folder", ({ id, mode }) => {
console.log(`Branch ${id} is ${mode ? "opened" : "closed"}`);
});
}
</script>
<Filemanager data={getData()} drive={getDrive()} bind:api />
Related articles: How to access File Manager API