Deprecated

Prefer assignOptions() as addMetadata() will be dropped in 2.0.

The function addMetadata() adds the metadata attribute to a deferred function. By default, no metadata is added to the execution.

Example:

import { addMetadata } from "@defer/client";
import { sayHello } from "./defer/sayHello";

const delayedSayHello = addMetadata(sayHello, { userId: "1", foo: "bar" });
await delayedSayHello("John Doe");