Before you're able to use the service you'll need to initialize with your tenant and application IDs.
Initialize Incognitus service
import { IncognitusService } from '@incognitus/client-web-core';
const IncognitusService.initialize({
tenantId: '{your tenant key}',
applicationId: '{your app id}',
});
Key | Description |
---|---|
tenantId | Your tenant id |
applicationId | The id of the application |
import { IncognitusService } from '@incognitus/client-web-core';
const svc = IncognitusService.instance;
const foobar = async () => {
if (await svc.isEnabled('{feature name}')) {
return 'new feature text';
}
return 'old feature text';
};
Method | Description |
---|---|
IncognitusService.initialize(config) | Initializes the service (must be called first) |
IncognitusService.instance | The shared instance of the service |
svc.isEnabled(featureName) | Checks if the flag is enabled |
svc.isDisabled(featureName) | Check if the flag is disabled |
svc.getFeature(featureName) | Fetches the feature from the server and returns it's status |
svc.getAllFeatures() | Fetches all features and stores them in the cache |
Currently all known feature flags are cached when the app initializes. New features that are not found
in the cache are retrieved on-demand. The cache stays in place until the app is reloaded or by calling the getAllFeatures()
method on the service.
- Save verified cache to local storage
- Provide hard cache refresh (wipe cache if fails)
- Provide soft cache refresh (keep cache if fails)
- Customizable cache refresh times
- Option to disable cache