Skip to content

FeatureManager

Doc edited this page Apr 20, 2025 · 1 revision

FeatureManager

This class is meant to handle all your features as well as their configuration value from Amaterasu.

Importing the required class

Make sure the path to the folder is correct.

import { FeatureManager } from "../tska/event/FeatureManager"

Creating a Manager

This requires an Amaterasu config instance, so you can go ahead and call getConfig

const myManager = new FeatureManager(config.getConfig())

Creating a Feature

Very simple you only need to pass in your desired data with the configName of your feature

const feature = myManager.createFeature("configName", "area", "subArea")

Note: This returns a Feature so you can use everything that is in a Feature

Creating a non-config Feature

In case you ever need to create a Feature without requiring a configName or rather a configValue

myManager.createFeatureNo("area", "subArea")

register/unregister All

This class also provides a way to register/unregister all of the features within it

myManager.register()
myManager.unregister()

What does this class handle for me?

  1. register/unregister the features
  2. Location area/subarea
  3. registerListener a configuration listener that tells each feature when they should be enabled

Clone this wiki locally