Skip to content

Features

A. Malthe Henriksen edited this page Jan 21, 2024 · 6 revisions

What are features?

Features are settings located in features.json. These settings are used by build variants to check for feature toggles and certain variables such as the document.title text in the application.

Adding a feature

To add a feature, create a new entry into features.json (including all build variants). This means we add a new entry into all variants of features.json in folders ./src/__viteBuildVariants__/[variant].

Then to be able to reference the feature in the Feature enum in file FeatureToggles.ts. The name should string variant should reflect the name in features.json.

Using features

We can use features specified in features.json by using the utility file FeatureToggles.ts

  document.title = getFeature(Feature.TITLE);
  // Or
  console.log(hasFeature(Feature.KNN_MODEL);
Clone this wiki locally