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 setup>
import { Kanban, RestDataProvider } from "@svar-ui/vue-kanban";
import { ref } from "vue";
const url = "https://api.example.com";
const provider = new RestDataProvider(url);
const cards = ref([]);
async function init(api) {
api.setNext(provider);
cards.value = await provider.getData();
}
</script>
<template>
<Kanban :cards="cards" :columns="columns" :init="init" />
</template>
Related
- Working with server - REST persistence and dynamic loading
- RestDataProvider - the built-in REST provider wired via setNext
- init - callback where setNext is typically called