Skip to main content

set-mode

Description

Fires when the mode type is changed

Usage

"set-mode": ({
mode: string
})

Parameters

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

  • mode - (required) the mode type which can be one of the following: "cards" | "table" | "panels" | "search" cards is the default value

If the callback function for this event returns false, the mode change operation will be blocked.

Example

In the example below we block the change of the mode type:

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

let api;

$: if (api) {
api.intercept("set-mode", ({ mode }) => {
console.log(`New mode: ${mode}`);
return false;
});
}
</script>

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

Related articles: How to access File Manager API