๐Active Variants API
If you wish to determine programmatically what variant Optibase has shown to the user, you can use the following global variable and function exposed by the Optibase Custom Script.
window.optibaseActiveVariants
Optibase Custom Script sets a global variable window.optibaseActiveVariants
when all the tests have been loaded, and the variants have been chosen and displayed.
The variable is an array of active variants with a type of:
The variable will only be set once the variants have been chosen and displayed. Before, the variable will be undefined
.
Note: Only Variants for Active and non-restricted Tests will be included. If the Main Variant is shown by default for a Test because the Test it is restricted or inactive, it will not be included in the optibaseActiveVariants.
window.optibaseAddActiveVariantsListener
Optibase Custom Script sets a global function window.optibaseAddActiveVariantsListener
that accepts a callback that will be triggered once the window.optibaseActiveVariants
have been set.
The function is of type:
You can use this to set a listener that will be triggered once the optibaseActiveVariants have been set.
Last updated