ab-test
ab-test copied to clipboard
Issue with minification
Hey there,
I'm getting an issue when minifying the library - abMfg is not using explicit annotation and cannot be invoked in strict mode
.
I've tried using explicit annotation in ab-svc.js, but can't get it going. Any thoughts?
I managed to fix this through updating ab-test.js to:
.factory('ab', ['abMfg', function (abMfg) {
return abMfg();
}])
and ab-svc.js to:
this.$get = ['AB', function (AB) {
return function abMfg(options) {
options = options || {};
var abjs = options.ab || AB;
// quick sanity check
if (!abjs) {
throw new Error('ab.js JavaScript library not provided');
}
// public API
return {
/**
Runs an a/b test with the variants and frequency provided.
@method test
@param {Array} variants to choose from
@param {Number} frequency float between 0.0001 and 1
**/
test: function (variants, frequency) {
return abjs.test(variants, frequency);
},
/**
Logs data to the given url for processing.
@method log
@param {Object} data to send
@param {String} url to send the data to
@param {Function} optional callback
**/
log: function (data, url, optional) {
return abjs.log(data, url, optional);
}
};
};
}];
I won't do a pull request as I was unsure how ab-svc is generated - but I'll leave this here for anyone else.