api.getReactiveState()
Description
Gets an object with the reactive properties of File ManagerThis method allows you to subscribe to the returned properties in the same way as actions.
Usage
api.getReactiveState(): object;
Returns
The method returns an object with the following reactive properties:
{
tree, //an array of objects containing the files structure data
mode,
preview,
search, // the search string
panels,
drive,
activePanel
}
All properties description you can find here: File Manager properties overview
Example
<script>
import { Filemanager } from "wx-svelte-filemanager";
import { getData, getDrive } from "./common/data";
let api, mode;
$: if (api) {
mode = api.getReactiveState().mode;
console.log($mode); //outputs mode on every mode change
}
</script>
<Filemanager bind:api data="{getData()}" drive="{getDrive()}" />
Related articles: