Skip to main content

api.getState()

Description

Gets the state object that stores current values of most File Manager properties

You can apply the method to get the state of selected files, mode, preview, drive memory, and etc.

Usage

api.getState(): object;

Returns

The method returns an object with the following parameters:

  {
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

In the example below we get the current mode:

<script>
import { Filemanager } from "@wx/svelte-filemanager";
import { getData, getDrive } from "./common/data";

let api;

$: if (api) {
const { mode } = api.getState();
console.log(mode);
}
</script>

<Filemanager
bind:api
data={getData()}
drive={getDrive()} />

Related articles: