@defer/client
assignOptions()
The assignOptions(deferFn, options)
function takes a deferred function and
applies execution options
:
delay
: schedule an execution for latermetadata
: add Metadata to the executiondiscardAfter
: discard an execution if not started after a given interval
Example:
import { assignOptions } from "@defer/client";
import { sayHello } from "./defer/sayHello";
const delayedSayHello = assignOptions(sayHello, {
delay: "1h",
metadata: {
who: "Bob",
},
});
await delayedSayHello("John Doe");
Was this page helpful?