Skip to main content

set-path

Description

Fires when a path is changed

Usage

"set-path": ({
id: string,
selected?: [],
panel?: 0|1,
})

Parameters

The callback of the set-path action takes an object with the following parameters:

  • id - (required) the ID of a new directory
  • selected - (optional) an array of files ids selected in a new directory
  • panel - (optional) the panel number where an item is selected (0|1); by default, the active panel number is set to 0

Example

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

let api;

$: if (api) {
api.on("set-path", ({ id }) => {
console.log(`The path changed to: ${id}`);
});
};

</script>

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

Related articles: How to access File Manager API