@blinkk/editor
Version:
Structured content editor with live previews.
41 lines (40 loc) • 1.47 kB
TypeScript
export interface FeatureManagerConfig {
defaultStatus: boolean;
}
export declare type FeatureManagerSettings = Record<string, any>;
export declare class FeatureManager {
config: FeatureManagerConfig;
features: Record<string, boolean | FeatureManagerSettings>;
protected internalSettings: Record<string, FeatureManagerSettings>;
constructor(config: FeatureManagerConfig);
/**
* Determine if a feature is turned off.
*
* @param featureKey Key to represent the feature.
* @returns True if the feature is off or the default is off.
*/
isOff(featureKey: string): boolean;
/**
* Determine if a feature is turned on.
*
* @param featureKey Key to represent the feature.
* @returns True if the feature is on or the default is on.
*/
isOn(featureKey: string): boolean;
/**
* Turn a feature off.
*
* @param featureKey Key to represent the feature.
* @returns false
*/
off(featureKey: string, settings?: FeatureManagerSettings): FeatureManagerSettings | boolean;
/**
* Turn a feature on.
*
* @param featureKey Key to represent the feature.
* @returns true
*/
on(featureKey: string, settings?: FeatureManagerSettings): FeatureManagerSettings | boolean;
set(featureKey: string, value: boolean | FeatureManagerSettings): FeatureManagerSettings | boolean;
settings(featureKey: string): FeatureManagerSettings | undefined;
}