api.setNext()
Description
Allows adding some action into the Event Bus orderUsage
api.setNext(next: any): void;
Parameters
next
- (required) the action to be included into the Event Bus order
Example
You need to include RestDataProvider into the Event Bus order to perform operations with tasks and send the corresponding requests to the server.
Example:
<script>
import { Gantt } from "@wx/svelte-gantt";
import { RestDataProvider } from "@wx/gantt-data-provider";
import { getData } from "./common/data";
const data = getData();
const url = "https://some_backend_url";
const server = new RestDataProvider(url);
let tasks = [];
let links = [];
server.getData().then(data => {
tasks = data.tasks;
links = data.links;
});
let api;
$: if (api) api.setNext(server);
</script>
<Gantt
{tasks}
{links}
bind:api />
Related articles: