1 | // Copyright (c) .NET Foundation. All rights reserved.
|
2 | // Licensed under the MIT License.
|
3 |
|
4 | import * as coreTypes from '@azure/functions-core';
|
5 |
|
6 | let coreApi: typeof coreTypes | undefined | null;
|
7 | export function tryGetCoreApiLazy(): typeof coreTypes | null {
|
8 | if (coreApi === undefined) {
|
9 | try {
|
10 | // eslint-disable-next-line @typescript-eslint/no-var-requires
|
11 | coreApi = <typeof coreTypes>require('@azure/functions-core');
|
12 | } catch {
|
13 | coreApi = null;
|
14 | }
|
15 | }
|
16 | return coreApi;
|
17 | }
|