Skip to main content

api.detach()

Description​

Allows removing/detaching action handlers

Usage​

api.detach(tag: number | string ): void;

Parameters​

  • tag - the name of the action tag

Example​

In the example below we add an object with the tag property to the api.on() and api.intercept() handlers, and then we use the api.detach() method to stop logging the actions.

<script setup>
import { getData, getDrive } from "./common/data";
import { Filemanager } from "@svar-ui/vue-filemanager";

function init(api) {
api.on(
"select-file",
({ id }) => {
console.log("Selected: " + id);
},
{ tag: "track" }
);

api.on(
"set-path",
({ id }) => {
console.log("Path: " + id);
},
{ tag: "track" }
);
}

function stop() {
api.detach("track");
}
</script>

<template>
<button :onclick="stop"> Stop logging </button>
<Filemanager :init="init" :data="getData()" :drive="getDrive()" />
</template>

Related articles: