1.0.1 • Published 4 years ago
@incognitus/client-web-core v1.0.1
Incognitus Feature Flag (web core)
Integrating Incognitus
Initializing the service
Before you're able to use the service you'll need to initialize with your tenant and application IDs.
index.ts
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 |
Checking features
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';
};
Methods
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 |
Caching
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.
Future Caching Stories
- 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
1.0.1
4 years ago
1.0.1-pre.4
4 years ago
1.0.1-pre.3
4 years ago
1.0.0
4 years ago
1.0.1-pre.1
4 years ago
1.0.0-pre.15
4 years ago
0.1.1-pre.14
4 years ago
0.1.1-pre.10
4 years ago
0.1.1-pre.12
4 years ago
0.1.1-pre.13
4 years ago
0.1.1-pre.6
4 years ago
0.1.0-pre.5
4 years ago
0.1.0-pre.4
4 years ago
0.1.1-pre.0
4 years ago