Hygiene: remove unused function AB.onABStart()

Callback usage was removed in I67fb6e448f6ecc97c89c1187e491ee05f7a312ef
so this function may be removed.

Bug: T191532
Change-Id: I88f0d6740c9e9615faba2e3c60772269c705f43e
This commit is contained in:
Stephen Niedzielski 2018-08-08 10:37:42 -05:00 committed by Jdlrobson
parent f67c410859
commit 061d155303
1 changed files with 7 additions and 31 deletions

View File

@ -1,31 +1,23 @@
/*
* Bucketing wrapper for creating AB-tests.
*
* Given a test name, sampling rate, and session ID, provides a class
* that buckets users into predefined bucket ("control", "A", "B") and
* starts an AB-test.
* Given a test name, sampling rate, and session ID, provides a class that buckets users into
* predefined bucket ("control", "A", "B") and starts an AB-test.
*/
( function ( mw, M, mwExperiments ) {
( function ( M, mwExperiments ) {
/**
* Buckets users based on params and exposes an `isEnabled` and `getBucket` method.
*
* @param {Object} config configuration object for AB test.
* @param {Object} config Configuration object for AB test.
* @param {string} config.testName
* @param {number} config.samplingRate sampling rate for the AB-test.
* @param {number} config.sessionId session ID for user bucketing
* @param {function} [config.onABStart] function that triggers event-logging when user is either
* in bucket A or B.
* @param {number} config.samplingRate Sampling rate for the AB-test.
* @param {number} config.sessionId Session ID for user bucketing.
* @constructor
*/
function AB( config ) {
var CONTROL_BUCKET = 'control',
testName = config.testName,
samplingRate = config.samplingRate,
sessionId = config.sessionId,
onABStart = config.onABStart || function () {},
test = {
name: testName,
enabled: !!samplingRate,
@ -38,7 +30,6 @@
/**
* Gets the users AB-test bucket
*
* @return {string} AB-test bucket, CONTROL_BUCKET by default, "A" or "B" buckets otherwise.
*/
function getBucket() {
@ -47,26 +38,12 @@
/**
* Checks whether or not a user is in the AB-test,
*
* @return {boolean}
*/
function isEnabled() {
return getBucket() !== CONTROL_BUCKET;
}
/**
* Initiates the AB-test.
*
* return {void}
*/
function init() {
if ( isEnabled() ) {
onABStart( getBucket() );
}
}
init();
return {
getBucket: getBucket,
isEnabled: isEnabled
@ -74,5 +51,4 @@
}
M.define( 'skins.minerva.scripts/AB', AB );
}( mw, mw.mobileFrontend, mw.experiments ) );
}( mw.mobileFrontend, mw.experiments ) );