- Source:
Methods
weightedBoolean(name, trueWeight, token) → {boolean}
Gets whether something is true given a name and a token.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the thing. Since this is used as the name of the underlying experiment it should be unique to reduce the likelihood of collisions with other enabled experiments |
trueWeight |
number | A number between 0 and 1, representing the probability of the thing being true |
token |
string | A token associated with the user for the duration of the experiment |
- Source:
Returns:
- Type
- boolean
Example
import createExperiments from './src/experiments';
const experiments = createExperiments( mw.experiments );
const isFooEnabled = experiments.weightedBoolean(
'foo',
10 / 100, // 10% of all unique tokens should have foo enabled.
token
);