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
Example
In the example below we use api.intercept()
to hide the default Editor by returning false.
<script>
import { getData } from "./common/data";
import { Gantt } from "@wx/svelte-gantt";
const data = getData();
let api;
$:if (api) {
api.intercept("show-editor", data => {
return false;
});
}
</script>
<Gantt bind:api tasks={data.tasks} />
Related articles: