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

import { Filemanager } from "@svar-ui/react-filemanager";
import { getData, getDrive } from "./common/data";

function init(api) {
api.intercept("set-mode", ({ mode }) => {
if (mode === "panels")
// do not switch to the panels mode
return false;
});
}

export default function App() {
return (
<Filemanager
init={init}
data={getData()}
drive={getDrive()}
mode={"cards"}
/>
);
}

Related articles: