api.intercept()
Description
Allows intercepting and preventing the inner events
Usage
api.intercept(
event: string,
callback: function,
config?: { intercept?: boolean, tag?: number | string | symbol }
): void;
Parameters
event
- (required) an event to be firedcallback
- (required) a callback to be performed (the callback arguments will depend on the event to be fired)config
- (optional) an object that stores the following parameters:intercept
- (optional) if you setintercept: true
during event listener creation, this event listener will run before all otherstag
- (optional) an action tag. You can use the tag name to remove an action handler via thedetach
method
Events
info
The full list of the Kanban internal events can be found here
Example
// create Kanban
const board = new kanban.Kanban("#root", {
columns,
cards
});
// forbid moving cards to the column with the "done" ID
board.api.intercept("move-card", ({ id, columnId }) => {
if(columnId !== "done" ){
return false;
}
}, {tag: "move"});
Change log: The config.tag and config.intercept parameters were added in v1.7