-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.ts
54 lines (46 loc) · 2.4 KB
/
client.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import * as configcatcommon from "./common/index.ts";
import { HttpConfigFetcher } from "./fetcher.ts";
import { InMemoryCache } from "./common/Cache.ts";
import { IConfigCatClient } from "./common/ConfigCatClient.ts";
import { LogLevel } from "./common/index.ts";
/** Create an instance of ConfigCatClient and setup Auto Polling mode with default options */
export function createClient(sdkKey: string): IConfigCatClient {
return createClientWithAutoPoll(sdkKey);
}
/**
* Create an instance of ConfigCatClient and setup Auto Polling mode with custom options
* @param {string} sdkKey - ConfigCat SdkKey to access your configuration.
* @param options - Options for Auto Polling
*/
export function createClientWithAutoPoll(sdkKey: string, options?: INodeAutoPollOptions): IConfigCatClient {
return configcatcommon.createClientWithAutoPoll(sdkKey, { configFetcher: new HttpConfigFetcher(), cache: new InMemoryCache() }, options);
}
/**
* Create an instance of ConfigCatClient and setup Manual Polling mode with custom options
* @param {string} sdkKey - ConfigCat SdkKey to access your configuration.
* @param options - Options for Manual Polling
*/
export function createClientWithManualPoll(sdkKey: string, options?: INodeManualPollOptions): IConfigCatClient {
return configcatcommon.createClientWithManualPoll(sdkKey, { configFetcher: new HttpConfigFetcher(), cache: new InMemoryCache() }, options)
}
/**
* Create an instance of ConfigCatClient and setup Lazy Loading mode with custom options
* @param {string} sdkKey - ConfigCat SdkKey to access your configuration.
* @param options - Option for Lazy Loading
*/
export function createClientWithLazyLoad(sdkKey: string, options?: INodeLazyLoadingOptions): IConfigCatClient {
return configcatcommon.createClientWithLazyLoad(sdkKey, { configFetcher: new HttpConfigFetcher(), cache: new InMemoryCache() }, options);
}
/**
* Create an instance of ConfigCatConsoleLogger
* @param logLevel Specifies message's filtering to output for the CofigCatConsoleLogger.
*/
export function createConsoleLogger(logLevel: LogLevel): configcatcommon.IConfigCatLogger {
return configcatcommon.createConsoleLogger(logLevel)
}
export interface INodeAutoPollOptions extends configcatcommon.IAutoPollOptions {
}
export interface INodeLazyLoadingOptions extends configcatcommon.ILazyLoadingOptions {
}
export interface INodeManualPollOptions extends configcatcommon.IManualPollOptions {
}