Skip to main content

setNext

Appends a handler to the end of the event bus chain so it receives every dispatched action after the built-in handlers run. This is how RestDataProvider wires itself into the kanban - it registers its REST handlers as the "next" link in the chain, forwarding card mutations to the backend automatically.

Usage

setNext(handler: any): any;

The handler is typically an object with its own action-handling methods (like the one returned by RestDataProvider). The method returns the handler that was passed in.

Example

Attaching a REST data provider:

<script>
import { Kanban, RestDataProvider } from "@svar-uisvelte-kanban";

const url = "https://api.example.com";
const provider = new RestDataProvider(url);

let cards = $state([]);

async function init(api) {
api.setNext(provider);
cards = await provider.getData();
}
</script>

<Kanban {cards} {columns} {init} />