compare Active Names
Compares the current activeNames list with the prevActiveNames list and triggers an action if there are any differences.
This function performs the following steps:
If the
restartflag is true, it triggers the action without comparisonIf
restartis false, it compares each name inactiveNamesto check if any name is new or removed compared toprevActiveNamesIf a change is detected, it calls the
triggerfunction with the updatedactiveNamesFinally, it updates
prevActiveNamesto reflect the currentactiveNames
Parameters
options
The options containing restart flag and parameters
Example:
val options = CompareActiveNamesOptions(
restart = false,
parameters = object : CompareActiveNamesParameters {
override val activeNames = listOf("Alice", "Bob")
override val prevActiveNames = listOf("Alice")
// ... other required implementations
}
)
compareActiveNames(options)Content copied to clipboard