Skip to main content

api.getReactiveState()

Description​

Gets an object with the reactive properties of File Manager

This 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:

{
data, //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 "@svar-ui/svelte-filemanager";
import { getData, getDrive } from "./common/data";

let mode;

function init(api){
mode = api.getReactiveState().mode;
console.log($mode); //outputs mode on every mode change
}
</script>

<Filemanager {init} data={getData()} drive={getDrive()} />

Related articles: