UNPKG

956 BTypeScriptView Raw
1// Copyright (c) .NET Foundation. All rights reserved.
2// Licensed under the MIT License.
3
4/**
5 * Base class for all hook context objects
6 */
7export declare class HookContext {
8 /**
9 * For testing purposes only. This will always be constructed for you when run in the context of the Azure Functions runtime
10 */
11 constructor(init?: HookContextInit);
12
13 /**
14 * The recommended place to store and share data between hooks in the same scope (app-level vs invocation-level).
15 * You should use a unique property name so that it doesn't conflict with other hooks' data.
16 * This object is readonly. You may modify it, but attempting to overwrite it will throw an error
17 */
18 readonly hookData: Record<string, unknown>;
19}
20
21/**
22 * Base interface for objects passed to HookContext constructors.
23 * For testing purposes only.
24 */
25export interface HookContextInit {
26 hookData?: Record<string, unknown>;
27}