api.intercept()
Description
Allows intercepting and blocking/modifying actionsUsage
api.intercept(
action: string,
callback: function
): void;
Parameters
action
- (required) an action to be firedcallback
- (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: