UNPKG

815 BPlain TextView Raw
1// Copyright (c) .NET Foundation. All rights reserved.
2// Licensed under the MIT License.
3
4import * as types from '@azure/functions';
5import { nonNullProp } from '../utils/nonNull';
6import { InvocationHookContext } from './InvocationHookContext';
7
8export class PreInvocationContext extends InvocationHookContext implements types.PreInvocationContext {
9 #init: types.PreInvocationContextInit;
10
11 constructor(init?: types.PreInvocationContextInit) {
12 super(init);
13 this.#init = init ?? {};
14 this.#init.functionCallback ??= () => {};
15 }
16
17 get functionHandler(): types.FunctionHandler {
18 return nonNullProp(this.#init, 'functionCallback');
19 }
20
21 set functionHandler(value: types.FunctionHandler) {
22 this.#init.functionCallback = value;
23 }
24}