### Start FeatureProbe Client (JS SDK) Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Initializes and starts the FeatureProbe client, enabling it to fetch feature flag configurations and begin evaluation. This method returns a Promise that resolves when the client is ready. ```APIDOC Method: start Signature: start(): Promise Returns: Promise ``` -------------------------------- ### Get current user from FeatureProbe client Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Retrieves the currently identified user object. This user is either the one most recently set via `identifyUser` or the initial user provided during client creation. The method returns an `FPUser` object. ```APIDOC getUser(): FPUser ``` -------------------------------- ### Get String Feature Flag Detail (JS SDK) Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Retrieves the string value of a feature flag for the current user, along with detailed information about how the value was determined. This includes the flag's key and a default value to use if the flag is unavailable. ```APIDOC Method: stringDetail Signature: stringDetail(key: string, defaultValue: string): FPDetail Parameters: key: string - The unique key of the toggle. defaultValue: string - The default value of the toggle, to be used if the value is not available from FeatureProbe. Returns: FPDetail ``` -------------------------------- ### Get JSON toggle value with detail from FeatureProbe Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Evaluates a feature toggle and returns its JSON value for the current user, along with detailed information about how the value was determined. It requires the toggle's key and a default value, returning an `FPDetail` interface. ```APIDOC jsonDetail(key: string, defaultValue: Record): FPDetail key: string - The unique key of the toggle. defaultValue: Record - The default value of the toggle, to be used if the value is not available from FeatureProbe. ``` -------------------------------- ### Get String Feature Flag Value (JS SDK) Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Determines the raw string value of a feature flag for the current user. This method requires the flag's key and a default value to return if the flag is not found or evaluated. ```APIDOC Method: stringValue Signature: stringValue(key: string, defaultValue: string): string Parameters: key: string - The unique key of the toggle. defaultValue: string - The default value of the toggle, to be used if the value is not available from FeatureProbe. Returns: string ``` -------------------------------- ### Get Number Feature Flag Detail (JS SDK) Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Retrieves the number value of a feature flag for the current user, along with detailed information about how the value was determined. This includes the flag's key and a default value to use if the flag is unavailable. ```APIDOC Method: numberDetail Signature: numberDetail(key: string, defaultValue: number): FPDetail Parameters: key: string - The unique key of the toggle. defaultValue: number - The default value of the toggle, to be used if the value is not available from FeatureProbe. Returns: FPDetail ``` -------------------------------- ### Get Number Feature Flag Value (JS SDK) Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Determines the raw number value of a feature flag for the current user. This method requires the flag's key and a default value to return if the flag is not found or evaluated. ```APIDOC Method: numberValue Signature: numberValue(key: string, defaultValue: number): number Parameters: key: string - The unique key of the toggle. defaultValue: number - The default value of the toggle, to be used if the value is not available from FeatureProbe. Returns: number ``` -------------------------------- ### Get JSON toggle value from FeatureProbe Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Determines the JSON value of a feature toggle for the current user. This method takes the toggle's unique key and a default value to use if the toggle is unavailable. It returns a `Record` representing the JSON value. ```APIDOC jsonValue(key: string, defaultValue: Record): Record key: string - The unique key of the toggle. defaultValue: Record - The default value of the toggle, to be used if the value is not available from FeatureProbe. ``` -------------------------------- ### Initialize FeatureProbe JS SDK and Evaluate Boolean Feature Flags Source: https://github.com/featureprobe/client-sdk-js/blob/main/example/index.html This JavaScript snippet demonstrates how to initialize the FeatureProbe JavaScript SDK, configure a user, set up event listeners for client lifecycle events (cache_ready, ready, update, error), and evaluate boolean feature flags using `boolValue` and `boolDetail` methods. It also shows how to wait until the client is ready using `waitUntilReady`. ```JavaScript const user = new featureProbe.FPUser(); user.with("userId", "00001"); const fpClient = new featureProbe.FeatureProbe({ remoteUrl: "https://featureprobe.io/server", clientSdkKey: "client-25614c7e03e9cb49c0e96357b797b1e47e7f2dff", user, refreshInterval: 5000, timeoutInterval: 5000, }); fpClient.on("cache_ready", function() { console.log("cache_ready", fpClient.allToggles()); }); fpClient.on("ready", function() { console.log("ready"); const boolValue = fpClient.boolValue("campaign_allow_list", false); document.getElementById("boolean-result").innerText = boolValue; const boolDetail = fpClient.boolDetail("campaign_allow_list", false); document.getElementById("boolean-detail").innerText = JSON.stringify(boolDetail); setTimeout(() => { const boolValue = fpClient.boolValue("campaign_allow_list", false); }, 1000); setTimeout(() => { const boolValue = fpClient.boolValue("campaign_allow_list", false); }, 10000); }); fpClient.on("update", function() { console.log("update"); }); fpClient.on("error", function() { console.log("error"); }); fpClient.on("fetch_toggle_error", function() { console.log("fetch_toggle_error"); }); fpClient.on("fetch_event_error", function() { console.log("fetch_event_error"); }); setTimeout(() => { fpClient.waitUntilReady().then(() => { console.log("wait until ready"); }).catch(() => { console.log("wait until ready catch"); }); }, 5000); fpClient.start(); ``` -------------------------------- ### FeatureProbe Class API Reference Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Comprehensive API documentation for the `FeatureProbe` class, which serves as the main entry point for interacting with the FeatureProbe SDK. It details the class hierarchy, constructor, private and public properties, accessors, and all available methods for feature flag evaluation, event tracking, and user management. ```APIDOC Class FeatureProbe Description: You can obtainan a client of FeatureProbe, which provides access to all of the SDK's functionality. Hierarchy: TinyEmitter -> FeatureProbe Defined in: src/FeatureProbe.ts:35 Constructors: constructor(__namedParameters: FPConfig) Parameters: __namedParameters: FPConfig Returns: FeatureProbe Overrides: TinyEmitter.constructor Defined in: src/FeatureProbe.ts:54 Properties: _clientSdkKey: string (Private) _enableRealtime: boolean (Private) _eventRecorder: EventRecorder (Private) _eventsUrl: string (Private) _getEventsUrl: string (Private) _readyPromise: null | Promise (Private) _realtimePath: string (Private) _realtimeUrl (Private) _refreshInterval (Private) _status (Private) _storage (Private) _timeoutInterval (Private) _timeoutTimer? (Private) _timer? (Private) _toggles (Private) _togglesUrl (Private) _user (Private) Accessors: clientSdkKey eventRecorder eventsUrl user Methods: allToggles boolDetail boolValue connectSocket emit errorInitialized fetchToggles flush getUser identifyUser jsonDetail jsonValue logout numberDetail numberValue off on once start stop stringDetail stringValue successInitialized toggleDetail toggleValue track waitUntilReady newForTest ``` -------------------------------- ### FeatureProbe JavaScript SDK: initializePlatform Function Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/functions/initializePlatform.html API documentation for the `initializePlatform` function, used to initialize the FeatureProbe SDK. It requires an `IOption` object as a parameter and returns void. ```APIDOC Function: initializePlatform Description: Initialize SDK with platform Signature: initializePlatform(options: IOption): void Parameters: options: IOption Description: The platform object Returns: void Defined in: src/index.ts:12 ``` -------------------------------- ### Static Method newForTest Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Creates a new FeatureProbe instance specifically for testing purposes, allowing the definition of predefined toggle states. ```APIDOC newForTest(toggles: { [key: string]: boolean }): FeatureProbe Parameters: toggles: { [key: string]: boolean } Returns: FeatureProbe ``` -------------------------------- ### FPUser Class API Documentation Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FPUser.html Comprehensive API documentation for the FPUser class, including its constructor, private properties, and public methods for managing user attributes and unique keys within the FeatureProbe Client Side SDK for JavaScript. ```APIDOC Class FPUser: Description: You can obtain a client of FPUser, which provides all of the FPUser's functionality. Hierarchy: FPUser Defined in: src/FPUser.ts:5 Constructors: new FPUser(key?: string): FPUser Parameters: key: string (Optional) Returns: FPUser Defined in: src/FPUser.ts:9 Properties: Private attrs: { [key: string]: string } Defined in: src/FPUser.ts:7 Private key: string Defined in: src/FPUser.ts:6 Methods: extendAttrs(attrs: { [key: string]: string }): FPUser Description: Extend several attributes of the FPUser client. Parameters: attrs: { [key: string]: string } (key-value pairs.) Returns: FPUser Defined in: src/FPUser.ts:53 get(attrName: string): undefined | string Description: Get attribute value of a specified attribute key. Parameters: attrName: string (The attribute key.) Returns: undefined | string Defined in: src/FPUser.ts:67 getAttrs(): { [key: string]: string } Description: Get all attributes of the FPUser client. Returns: { [key: string]: string } Defined in: src/FPUser.ts:42 getKey(): string Description: Get the unique key of the FPUser client. Returns: string Defined in: src/FPUser.ts:31 stableRollout(key: string): FPUser Description: Change a stable key for the FPUser client. Parameters: key: string (The unique FPUser key.) Returns: FPUser Defined in: src/FPUser.ts:78 with(attrName: string, attrValue: string): FPUser Description: Upload attributes to the FPUser client. Parameters: attrName: string (The attribute key.) attrValue: string (The attribute value.) Returns: FPUser Defined in: src/FPUser.ts:23 ``` -------------------------------- ### Handle Successful Initialization (JS SDK) Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html A private method internally used to handle the successful initialization state of the FeatureProbe client. This method does not return any value. ```APIDOC Method: successInitialized Signature: successInitialized(): void Returns: void ``` -------------------------------- ### FeatureProbe Class API Reference for JavaScript SDK Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html This snippet provides a structured overview of the `FeatureProbe` class, its constructor, private and public properties, and all available methods within the FeatureProbe Client Side SDK for JavaScript. It details the core functionalities for interacting with feature flags and user management. ```APIDOC FeatureProbe Class: constructor() Private Properties: _clientSdkKey _enableRealtime _eventRecorder _eventsUrl _getEventsUrl _readyPromise _realtimePath _realtimeUrl _refreshInterval _status _storage _timeoutInterval _timeoutTimer? _timer? _toggles _togglesUrl _user Public Properties: clientSdkKey eventRecorder eventsUrl user Methods: allToggles() boolDetail() boolValue() connectSocket() emit() errorInitialized() fetchToggles() flush() getUser() identifyUser() jsonDetail() jsonValue() logout() numberDetail() numberValue() off() on() once() start() stop() stringDetail() stringValue() successInitialized() toggleDetail() toggleValue() track() waitUntilReady() newForTest() ``` -------------------------------- ### JavaScript Theme Setting from Local Storage Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/functions/getPlatform.html This JavaScript snippet demonstrates how to set the `data-theme` attribute on the document's root element. It attempts to retrieve a theme preference from `localStorage` under the key 'tsd-theme' and falls back to 'os' if no preference is found. ```JavaScript document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os" ``` -------------------------------- ### FeatureProbe JavaScript SDK API Index Overview Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/index.html This section provides a structured overview of the FeatureProbe Client Side SDK for JavaScript's public API. It categorizes the main components into Classes, Interfaces, Type Aliases, and Functions, serving as a quick reference to the SDK's structure. ```APIDOC FeatureProbe Client Side SDK for JavaScript (2.2.1) API Index: Classes: - FPUser - FeatureProbe Interfaces: - FPConfig - FPDetail - FPStorageProvider - IHttpRequest - IOption - IPlatForm Type Aliases: - IReturnValue Functions: - getPlatform - initializePlatform - setPlatform ``` -------------------------------- ### FPConfig Interface Definition and Properties for JavaScript SDK Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/interfaces/FPConfig.html Defines the configuration options for the FeatureProbe JavaScript SDK, including authentication, event reporting, real-time updates, and server URLs. This interface is crucial for setting up the SDK's behavior upon initialization. ```APIDOC Interface FPConfig Hierarchy: - FPConfig Properties: clientSdkKey: string Description: The Client SDK Key is used to authentification. enableAutoReporting?: boolean Description: Whether SDK should report pageview and click event automatically. Default value is true. enableRealtime?: boolean Description: Whether SDK should use WebSocket. Default value is false. eventsUrl?: string Description: The specific URL to post events, if not set, will generate from remoteUrl. realtimePath?: string Description: The specific path to receive realtime events, if not set, default value will be used. realtimeUrl?: string Description: The specific URL to receive realtime events, if not set, will generate from remoteUrl. refreshInterval?: number Description: Milliseconds for SDK to check for update. remoteUrl?: string Description: The unified URL to connect FeatureProbe Server. timeoutInterval?: number Description: Milliseconds for SDK to initialize, SDK will emit an `error` event when milliseconds reach. togglesUrl?: string Description: The specific URL to get toggles, if not set, will generate from remoteUrl. user: FPUser Description: The User with attributes like name, age is used when toggle evaluation. ``` -------------------------------- ### Private fetchToggles() method Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html An internal asynchronous method designed to fetch the latest feature toggle configurations from the FeatureProbe service. It returns a Promise that resolves to void upon completion. ```APIDOC fetchToggles(): Promise ``` -------------------------------- ### Set HTML Theme from Local Storage Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/interfaces/FPDetail.html This JavaScript snippet retrieves the theme preference from local storage and applies it to the document's root element. If no theme is found in local storage, it defaults to 'os'. ```JavaScript document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os" ``` -------------------------------- ### IPlatForm Interface Definition Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/interfaces/IPlatForm.html Defines the `IPlatForm` interface, which provides abstractions for platform-specific operations within the FeatureProbe Client Side SDK for JavaScript. It includes properties for user agent, HTTP requests, and local storage, as well as a method for socket communication. ```APIDOC Interface IPlatForm Hierarchy: IPlatForm Defined in: src/types.ts:165 Properties: UA: string Defined in: src/types.ts:167 httpRequest: IHttpRequest Defined in: src/types.ts:168 localStorage: FPStorageProvider Defined in: src/types.ts:166 Methods: socket(uri: string, opts?: Partial): Socket Parameters: uri: string opts: Partial (Optional) Returns: Socket Defined in: src/types.ts:169 ``` -------------------------------- ### Private toggleDetail Method Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Retrieves detailed information for a feature toggle, including its key, default value, and type. Returns an array of FPDetail objects. ```APIDOC toggleDetail(key: string, defaultValue: IReturnValue, valueType: string): FPDetail[] Parameters: key: string defaultValue: IReturnValue valueType: string Returns: FPDetail[] ``` -------------------------------- ### FeatureProbe setPlatform Function API Reference Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/functions/setPlatform.html Detailed API documentation for the `setPlatform` function in the FeatureProbe Client Side SDK for JavaScript. It describes the function signature, parameters, and return type. ```APIDOC Function setPlatform Signature: setPlatform(platform: IPlatForm): void Parameters: platform: IPlatForm - The platform configuration object. Returns: void Defined in: src/platform.ts:70 ``` -------------------------------- ### JavaScript Theme Setting from Local Storage Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/functions/setPlatform.html A JavaScript snippet that sets the `data-theme` attribute on the document's root element based on a value stored in `localStorage`, defaulting to 'os' if not found. ```JavaScript document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os" ``` -------------------------------- ### FeatureProbe Method: allToggles Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Retrieves an object containing details for all feature toggles available to the current user. This method provides a comprehensive view of all active feature flags and their associated data. ```APIDOC Method: allToggles(): undefined | { [key: string]: FPDetail } Description: Returns an object of all available toggles' details to the current user. Returns: undefined | { [key: string]: FPDetail } ``` -------------------------------- ### Identify user for FeatureProbe client Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Changes the current user context for the FeatureProbe client. All subsequent feature toggle evaluations will be performed against this new user. This method takes an `FPUser` instance as a parameter and returns void. ```APIDOC identifyUser(user: FPUser): void user: FPUser - A new FPUser instance. ``` -------------------------------- ### Private errorInitialized() method Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html An internal method used to handle and signal errors during the SDK's initialization process. It takes no parameters and returns void. ```APIDOC errorInitialized(): void ``` -------------------------------- ### FPStorageProvider Interface Definition Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/interfaces/FPStorageProvider.html Defines the structure and methods for a custom storage provider used by the FeatureProbe Client Side SDK for JavaScript. This interface ensures consistent data retrieval and storage operations for the SDK. ```APIDOC Interface FPStorageProvider Defined in src/types.ts:127 Properties: getItem: ((key: string) => Promise) Description: Get data from storage. Parameters: key: string - The key of the storage item. Returns: Promise setItem: ((key: string, data: string) => Promise) Description: Save data to storage. Parameters: key: string - The key of the storage item. data: string - The data of the storage item. Returns: Promise ``` -------------------------------- ### Wait Until Client Ready Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Returns a Promise that resolves when the FeatureProbe client successfully fetches toggles from the server, or rejects if an error occurs before the timeout interval. ```APIDOC waitUntilReady(): Promise Returns: Promise ``` -------------------------------- ### Private connectSocket() method Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html An internal method responsible for establishing a socket connection to the FeatureProbe service. It does not take any parameters and returns void. ```APIDOC connectSocket(): void ``` -------------------------------- ### IOption Interface Definition Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/interfaces/IOption.html Defines the IOption interface, a core configuration object in the FeatureProbe Client Side SDK for JavaScript. This interface specifies the 'platform' property, which is of type IPlatForm. ```APIDOC Interface IOption Hierarchy: - IOption Properties: platform: IPlatForm ``` -------------------------------- ### FeatureProbe JavaScript SDK getPlatform API Reference Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/functions/getPlatform.html API documentation for the `getPlatform` function, part of the FeatureProbe Client Side SDK for JavaScript. This function is used to retrieve an array of platform interface objects. ```APIDOC Function: getPlatform Signature: getPlatform(): IPlatForm[] Returns: Type: IPlatForm[] Description: An array of objects conforming to the IPlatForm interface, representing platform information. Source: src/platform.ts:74 ``` -------------------------------- ### FeatureProbe Public Accessors Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Public getter methods providing read-only access to key properties of the FeatureProbe client, such as SDK key, event recorder, event URL, and user details. ```APIDOC Accessor: get clientSdkKey(): string Returns: string Accessor: get eventRecorder(): EventRecorder Returns: EventRecorder Accessor: get eventsUrl(): string Returns: string Accessor: get user(): FPUser Returns: FPUser ``` -------------------------------- ### FeatureProbe Private Properties Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Internal properties of the FeatureProbe client, used for managing SDK state and configuration. These properties are not intended for direct external access. ```APIDOC Property: _realtimeUrl: string Visibility: Private Property: _refreshInterval: number Visibility: Private Property: _status: string Visibility: Private Property: _storage: FPStorageProvider Visibility: Private Property: _timeoutInterval: number Visibility: Private Property: _timeoutTimer?: Timer Visibility: Private Optional Property: _timer?: Timer Visibility: Private Optional Property: _toggles: undefined | { [key: string]: FPDetail } Visibility: Private Property: _togglesUrl: string Visibility: Private Property: _user: FPUser Visibility: Private ``` -------------------------------- ### Add Event Listener (JS SDK) Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Registers an event listener with the FeatureProbe client. This method is inherited from TinyEmitter and allows a callback function to be executed when a specific event occurs, optionally with a context. ```APIDOC Method: on Signature: on(event: string, callback: Function, ctx?: any): FeatureProbe Parameters: event: string callback: Function ctx: any (Optional) Returns: FeatureProbe Inherited from TinyEmitter.on ``` -------------------------------- ### IHttpRequest Interface Definition Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/interfaces/IHttpRequest.html Defines the structure and methods of the IHttpRequest interface, which is used for abstracting HTTP request operations in the FeatureProbe Client Side SDK. ```APIDOC Interface IHttpRequest: Defined in src/types.ts:148 Properties: get: ((url: string, headers: Record, data: Record, successCb: ((json: unknown) => void), errorCb: ((e: string) => void)) => void) Parameters: url: string headers: Record data: Record successCb: ((json: unknown) => void) Parameters: json: unknown Returns: void errorCb: ((e: string) => void) Parameters: e: string Returns: void Returns: void Defined in src/types.ts:149 post: ((url: string, headers: Record, data: string, successCb: (() => void), errorCb: ((e: string) => void)) => void) Parameters: url: string headers: Record data: string successCb: (() => void) Returns: void errorCb: ((e: string) => void) Parameters: e: string Returns: void Returns: void Defined in src/types.ts:156 ``` -------------------------------- ### Emit an event with FeatureProbe client Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Emits a custom event with the specified event name and additional arguments. This method is inherited from TinyEmitter, allowing for event-driven interactions within the SDK. It returns the FeatureProbe instance for chaining. ```APIDOC emit(event: string, ...args: any[]): FeatureProbe event: string ...args: any[] ``` -------------------------------- ### Flush FeatureProbe events Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Manually pushes any accumulated events (e.g., evaluation events, custom events) to the FeatureProbe server. This method is useful for ensuring events are sent immediately rather than waiting for the automatic flush interval. It returns void. ```APIDOC flush(): void ``` -------------------------------- ### FPDetail Interface Definition Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/interfaces/FPDetail.html Defines the structure of the `FPDetail` interface, which encapsulates the detailed result of a feature toggle evaluation, including the evaluated value, the reason for the evaluation, and various metadata. ```APIDOC Interface FPDetail Hierarchy: FPDetail Defined in: src/types.ts:28 Properties: debugUntilTime?: number Description: Debug deadline timestamp Defined in: src/types.ts:67 lastModified?: number Description: Toggle last modified timestamp Defined in: src/types.ts:62 reason: string Description: Why return this value, like disabled, default, not exist and so on. Defined in: src/types.ts:52 ruleIndex: null | number Description: The sequence number of the rule in the UI configuration that hit the rule. Defined in: src/types.ts:37 trackAccessEvents?: boolean Description: Whether to report access events. Defined in: src/types.ts:57 value: string | number | boolean | Record Description: The value corresponding to the rule in the UI platform. Defined in: src/types.ts:32 variationIndex: null | number Description: The sequence number of the variation in the UI platform. Defined in: src/types.ts:42 version: null | number Description: The version of the toggle. Defined in: src/types.ts:47 ``` -------------------------------- ### Private toggleValue Method Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Retrieves the evaluated value for a feature toggle based on its key, a default value, and the expected value type. Returns an IReturnValue. ```APIDOC toggleValue(key: string, defaultValue: IReturnValue, valueType: string): IReturnValue Parameters: key: string defaultValue: IReturnValue valueType: string Returns: IReturnValue ``` -------------------------------- ### Add One-Time Event Listener (JS SDK) Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Registers an event listener that will be executed only once for a specific event on the FeatureProbe client. This method is inherited from TinyEmitter and automatically unregisters the callback after its first invocation. ```APIDOC Method: once Signature: once(event: string, callback: Function, ctx?: any): FeatureProbe Parameters: event: string callback: Function ctx: any (Optional) Returns: FeatureProbe Inherited from TinyEmitter.once ``` -------------------------------- ### Track Custom Event Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Records a custom event with a specified name and an optional associated value. This method does not return any value. ```APIDOC track(name: string, value?: unknown): void Parameters: name: string value: unknown (Optional) Returns: void ``` -------------------------------- ### FeatureProbe Method: boolDetail Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Evaluates a feature toggle and returns its boolean value along with detailed information about how the value was determined. This is useful for debugging and understanding the evaluation process. ```APIDOC Method: boolDetail(key: string, defaultValue: boolean): FPDetail Description: Determines the return boolean value of a toggle for the current user, along with information about how it was calculated. Parameters: key: string - The unique key of the toggle. defaultValue: boolean - The default value of the toggle, to be used if the value is not available from FeatureProbe. Returns: FPDetail ``` -------------------------------- ### Logout current user from FeatureProbe client Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Logs out the currently identified user, effectively switching the client's context to an anonymous user. This ensures that subsequent toggle evaluations are not tied to a specific user profile. It returns void. ```APIDOC logout(): void ``` -------------------------------- ### Stop FeatureProbe Client (JS SDK) Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Shuts down the FeatureProbe client. Once stopped, the SDK will cease listening for feature flag changes and will no longer send metrics to the FeatureProbe server, effectively disabling its functionality. ```APIDOC Method: stop Signature: stop(): void Returns: void ``` -------------------------------- ### FeatureProbe Method: boolValue Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Determines the boolean value of a feature toggle for the current user. This method provides a simple boolean result, suitable for direct conditional logic. ```APIDOC Method: boolValue(key: string, defaultValue: boolean): boolean Description: Determines the return boolean value of a toggle for the current user. Parameters: key: string - The unique key of the toggle. defaultValue: boolean - The default value of the toggle, to be used if the value is not available from FeatureProbe. Returns: boolean ``` -------------------------------- ### Remove Event Listener (JS SDK) Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/classes/FeatureProbe.html Removes an event listener previously registered with the FeatureProbe client. This method is inherited from TinyEmitter and allows for unregistering specific callbacks for a given event. ```APIDOC Method: off Signature: off(event: string, callback?: Function): FeatureProbe Parameters: event: string callback: Function (Optional) Returns: FeatureProbe Inherited from TinyEmitter.off ``` -------------------------------- ### IReturnValue Type Alias Definition Source: https://github.com/featureprobe/client-sdk-js/blob/main/docs/types/IReturnValue.html Defines the `IReturnValue` type alias in the FeatureProbe Client Side SDK for JavaScript, specifying the possible data types that can be returned by feature flag evaluations. ```APIDOC IReturnValue: string | number | boolean | Record ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.