Skip to main content

api.setNext()

Description​

Allows adding some action into the Event Bus order

Usage​

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 "@svar-ui/svelte-gantt";
import { RestDataProvider } from "@svar-ui/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;
});

function init(api) {
api.setNext(server);
}
</script>

<Gantt
{tasks}
{links}
{init} />

Related articles: