1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | import { Platform } from './platforms/platform';
|
18 | declare type FlagValue = number | boolean;
|
19 | declare type FlagEvaluationFn = (() => FlagValue) | (() => Promise<FlagValue>);
|
20 | export declare type Flags = {
|
21 | [featureName: string]: FlagValue;
|
22 | };
|
23 | export declare type FlagRegistryEntry = {
|
24 | evaluationFn: FlagEvaluationFn;
|
25 | setHook?: (value: FlagValue) => void;
|
26 | };
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | export declare class Environment {
|
35 | global: any;
|
36 | private flags;
|
37 | private flagRegistry;
|
38 | private urlFlags;
|
39 | platformName: string;
|
40 | platform: Platform;
|
41 | getQueryParams: typeof getQueryParams;
|
42 | constructor(global: any);
|
43 | setPlatform(platformName: string, platform: Platform): void;
|
44 | registerFlag(flagName: string, evaluationFn: FlagEvaluationFn, setHook?: (value: FlagValue) => void): void;
|
45 | getAsync(flagName: string): Promise<FlagValue>;
|
46 | get(flagName: string): FlagValue;
|
47 | getNumber(flagName: string): number;
|
48 | getBool(flagName: string): boolean;
|
49 | getFlags(): Flags;
|
50 | readonly features: Flags;
|
51 | set(flagName: string, value: FlagValue): void;
|
52 | private evaluateFlag;
|
53 | setFlags(flags: Flags): void;
|
54 | reset(): void;
|
55 | private populateURLFlags;
|
56 | }
|
57 | export declare function getQueryParams(queryString: string): {
|
58 | [key: string]: string;
|
59 | };
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | export declare function env(): Environment;
|
69 | export declare let ENV: Environment;
|
70 | export declare function setEnvironmentGlobal(environment: Environment): void;
|
71 | export {};
|