Skip to main content
Module

x/denops_std/anonymous/mod.ts>remove

📚 Standard module for denops.vim
Go to Latest
function remove
Deprecated
Deprecated

Use lambda.unregister() function instead.

import { remove } from "https://deno.land/x/denops_std@v4.1.7/anonymous/mod.ts";

Remove anonymous functions from denops API identified by the identifiers

import { Denops } from "../mod.ts";
import * as anonymous from "./mod.ts";

export async function main(denops: Denops): Promise<void> {
  // Add anonymous functions
  const ids = anonymous.add(
    denops,
    () => {
      // Do what ever you want.
    },
    () => {
      // Do what ever you want.
    },
    // You can add as many callbacks as you want...
  );

  // Remove ids[1]
  anonymous.remove(denops, ids[1]);

  // Call of ids[0] complete normally
  await denops.dispatch(denops.name, ids[0]);

  // But ids[1] is already removed
  await denops.dispatch(denops.name, ids[1]);
}

Type Parameters

N extends number

Parameters

denops: Denops
...ids: Identifier[] & { length: N; }

Returns

TupleOf<boolean, N>