Skip to main content

api.intercept()

Description

Allows intercepting and blocking/modifying actions

Usage

api.intercept(
action: string,
callback: function
): void;

Parameters

  • action - (required) an action to be fired
  • callback - (required) a callback to be performed (the callback arguments will depend on the action to be fired)
info

The full list of the File Manager actions can be found here. Use the api.intercept() method if you want to modify actions. To listen to the actions without changes apply the api.on() method.

Example

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

let api;

$: if (api) {
api.intercept("set-mode", ({ mode }) => {
if (mode == "panels")
//do not switching to the panels mode
return false;
});
}
</script>

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

Related articles: