1 | // Copyright (c) .NET Foundation. All rights reserved.
|
2 | // Licensed under the MIT License.
|
3 |
|
4 | import { Disposable } from '../index';
|
5 | import { AppStartHandler, AppTerminateHandler } from './appHooks';
|
6 | import { PostInvocationHandler, PreInvocationHandler } from './invocationHooks';
|
7 |
|
8 | /**
|
9 | * Register a hook to be run at the start of your application
|
10 | *
|
11 | * @param handler the handler for the hook
|
12 | * @returns a `Disposable` object that can be used to unregister the hook
|
13 | */
|
14 | export function appStart(handler: AppStartHandler): Disposable;
|
15 |
|
16 | /**
|
17 | * Register a hook to be run during graceful shutdown of your application.
|
18 | * This hook will not be executed if your application is terminated forcefully.
|
19 | * Hooks have a limited time to execute during the termination grace period.
|
20 | *
|
21 | * @param handler the handler for the hook
|
22 | * @returns a `Disposable` object that can be used to unregister the hook
|
23 | */
|
24 | export function appTerminate(handler: AppTerminateHandler): Disposable;
|
25 |
|
26 | /**
|
27 | * Register a hook to be run before a function is invoked.
|
28 | *
|
29 | * @param handler the handler for the hook
|
30 | * @returns a `Disposable` object that can be used to unregister the hook
|
31 | */
|
32 | export function preInvocation(handler: PreInvocationHandler): Disposable;
|
33 |
|
34 | /**
|
35 | * Register a hook to be run after a function is invoked.
|
36 | *
|
37 | * @param handler the handler for the hook
|
38 | * @returns a `Disposable` object that can be used to unregister the hook
|
39 | */
|
40 | export function postInvocation(handler: PostInvocationHandler): Disposable;
|