@atlaskit/feature-gate-single-fetch-provider
TypeScript icon, indicating that this package has built-in type declarations

1.1.3 • Public • Published

SingleFetchProvider

Provider which does a single fetch get values from feature-flag-service on page loads and when a user is updated. To be used with the @atlaskit/feature-gate-js-client

Usage

Used when initializing the feature-gate-js-client using initializeWithProvider.

import FeatureGates, { FeatureGateEnvironment, FeatureGateProducts } from '@atlaskit/feature-gate-js-client';
import SingleFetchProvider from '@atlaskit/feature-gate-single-fetch-provider';

try {
  await FeatureGates.initializeWithProvider(
    clientOptions,
	new SingleFetchProvider({
		// This is an fx3 api key used to fetch the feature flag values.
        // Supported keys found at go/fx3/resources/api-keys
		apiKey: 'client-test',
		// [Optional] Default is 2000ms
		// This is the fetch timeout used for requests to feature-flag-service to get values to bootstrap the client.
		// The higher this value the longer your application will need to wait to render if you block on client initialization
		// Too low and your application will be more likely to fallback on default values
		fetchTimeoutMs: 1000,
		// [Optional] Default is false
		// This is a boolean to indicate whether to use the `gateway/api` url for the request to feature flag service.
		// Note that this option takes precendence over the environment and perimeter options in building the url.
		// To be used for applications with strict cross-origin policies, as it will keep all requests to the same origin.
		useGatewayUrl: true,
	})
    identifiers,
    customAttributes
  );
} catch (err) {
  console.error("Failed to initialize FeatureGates client.", err);
}

Detailed docs and example usage can be found here.

Readme

Keywords

none

Package Sidebar

Install

npm i @atlaskit/feature-gate-single-fetch-provider

Weekly Downloads

119

Version

1.1.3

License

Apache-2.0

Unpacked Size

21.9 kB

Total Files

19

Last publish

Collaborators

  • atlassianartifactteam
  • atlaskit-user