Skip to main content
Module

x/hooks/src/index.ts>hooks

Async middleware for JavaScript and TypeScript
Latest
function hooks
import { hooks } from "https://deno.land/x/hooks@v0.9.0/src/index.ts";

Returns a new function that wraps an existing async function with hooks.

Type Parameters

F
optional
T = any

Parameters

fn: F & (() => void)

The async function to add hooks to.

optional
manager: HookManager

An array of middleware or hook settings (middleware([]).params() etc.)

Add hooks to one or more methods on an object or class.

Parameters

obj: O | (new (...args: any[]) => O)

The object to add hooks to

hookMap: HookMap<O> | AsyncMiddleware[]

A map of middleware settings where the key is the method name.

Decorate a class method with hooks.

Type Parameters

optional
T = any

Parameters

optional
manager: HookOptions

The hooks settings