From c88895363df7d318a1b13a69c75b3b0a536cddf8 Mon Sep 17 00:00:00 2001 From: John Wehr Date: Fri, 5 Feb 2016 15:08:42 -0500 Subject: [PATCH] Fix spelling errors in error messages. Replace outdated reference to emitter.addExperimentVariant in error message. #5 --- lib/emitter.js | 4 ++-- src/emitter.jsx | 4 ++-- standalone.min.js | 24 ++++++++++++------------ test/browser/emitter.test.jsx | 16 ++++++++-------- test/browser/experiment.test.jsx | 4 ++-- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/emitter.js b/lib/emitter.js index c5f1d21..b795c3a 100644 --- a/lib/emitter.js +++ b/lib/emitter.js @@ -181,12 +181,12 @@ PushtellEventEmitter.prototype.addExperimentVariant = function (experimentName, experimentWeights[experimentName] = experimentWeights[experimentName] || {}; if (experiments[experimentName][variantName] !== true) { if (experimentsWithDefinedVariants[experimentName]) { - var error = new Error("Expiriment “" + experimentName + "” added new variants after variants were defined."); + var error = new Error("Experiment “" + experimentName + "” added new variants after variants were defined."); error.type = "PUSHTELL_INVALID_VARIANT"; throw error; } if (values[experimentName]) { - var error = new Error("Expiriment “" + experimentName + "” added new variants after a variant was selected. Declare the variant names using emitter.addExpirimentVariants(expirimentName, variantNames)."); + var error = new Error("Experiment “" + experimentName + "” added new variants after a variant was selected. Declare the variant names using emitter.defineVariants(experimentName, variantNames)."); error.type = "PUSHTELL_INVALID_VARIANT"; throw error; } diff --git a/src/emitter.jsx b/src/emitter.jsx index e8bd2ff..8c20327 100644 --- a/src/emitter.jsx +++ b/src/emitter.jsx @@ -175,12 +175,12 @@ PushtellEventEmitter.prototype.addExperimentVariant = function(experimentName, v experimentWeights[experimentName] = experimentWeights[experimentName] || {}; if(experiments[experimentName][variantName] !== true) { if(experimentsWithDefinedVariants[experimentName]) { - const error = new Error("Expiriment “" + experimentName + "” added new variants after variants were defined."); + const error = new Error("Experiment “" + experimentName + "” added new variants after variants were defined."); error.type = "PUSHTELL_INVALID_VARIANT"; throw error; } if(values[experimentName]) { - const error = new Error("Expiriment “" + experimentName + "” added new variants after a variant was selected. Declare the variant names using emitter.addExpirimentVariants(expirimentName, variantNames)."); + const error = new Error("Experiment “" + experimentName + "” added new variants after a variant was selected. Declare the variant names using emitter.defineVariants(experimentName, variantNames)."); error.type = "PUSHTELL_INVALID_VARIANT"; throw error; } diff --git a/standalone.min.js b/standalone.min.js index 9dfc441..2dd8279 100644 --- a/standalone.min.js +++ b/standalone.min.js @@ -384,7 +384,6 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule warning */ 'use strict'; @@ -447,7 +446,6 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule emptyFunction */ "use strict"; @@ -674,12 +672,12 @@ experimentWeights[experimentName] = experimentWeights[experimentName] || {}; if (experiments[experimentName][variantName] !== true) { if (experimentsWithDefinedVariants[experimentName]) { - var error = new Error("Expiriment “" + experimentName + "” added new variants after variants were defined."); + var error = new Error("Experiment “" + experimentName + "” added new variants after variants were defined."); error.type = "PUSHTELL_INVALID_VARIANT"; throw error; } if (values[experimentName]) { - var error = new Error("Expiriment “" + experimentName + "” added new variants after a variant was selected. Declare the variant names using emitter.addExpirimentVariants(expirimentName, variantNames)."); + var error = new Error("Experiment “" + experimentName + "” added new variants after a variant was selected. Declare the variant names using emitter.defineVariants(experimentName, variantNames)."); error.type = "PUSHTELL_INVALID_VARIANT"; throw error; } @@ -973,7 +971,7 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. - * + * * @providesModule EventSubscription * @typechecks */ @@ -1005,7 +1003,10 @@ */ EventSubscription.prototype.remove = function remove() { - this.subscriber.removeSubscription(this); + if (this.subscriber) { + this.subscriber.removeSubscription(this); + this.subscriber = null; + } }; return EventSubscription; @@ -1137,7 +1138,7 @@ * @providesModule invariant */ - "use strict"; + 'use strict'; /** * Use invariant() to assert state which your program assumes to be true. @@ -1150,7 +1151,7 @@ * will remain to ensure logic does not differ in production. */ - var invariant = function (condition, format, a, b, c, d, e, f) { + function invariant(condition, format, a, b, c, d, e, f) { if (process.env.NODE_ENV !== 'production') { if (format === undefined) { throw new Error('invariant requires an error message argument'); @@ -1164,15 +1165,16 @@ } else { var args = [a, b, c, d, e, f]; var argIndex = 0; - error = new Error('Invariant Violation: ' + format.replace(/%s/g, function () { + error = new Error(format.replace(/%s/g, function () { return args[argIndex++]; })); + error.name = 'Invariant Violation'; } error.framesToPop = 1; // we don't care about invariant's own frame throw error; } - }; + } module.exports = invariant; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) @@ -1276,7 +1278,6 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule crc32 * */ @@ -1548,7 +1549,6 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * @providesModule ExecutionEnvironment */ 'use strict'; diff --git a/test/browser/emitter.test.jsx b/test/browser/emitter.test.jsx index a5bfc55..e0cad39 100644 --- a/test/browser/emitter.test.jsx +++ b/test/browser/emitter.test.jsx @@ -32,8 +32,8 @@ describe("Emitter", function() { }; let experimentNameGlobal = null; let playedVariantNameGlobal = null; - let playCallbackGlobal = function(expirimentName, variantName){ - experimentNameGlobal = expirimentName; + let playCallbackGlobal = function(experimentName, variantName){ + experimentNameGlobal = experimentName; playedVariantNameGlobal = variantName; }; let playSubscription = emitter.addPlayListener(experimentName, playCallback); @@ -64,8 +64,8 @@ describe("Emitter", function() { }; let experimentNameGlobal = null; let winningVariantNameGlobal = null; - let winCallbackGlobal = function(expirimentName, variantName){ - experimentNameGlobal = expirimentName; + let winCallbackGlobal = function(experimentName, variantName){ + experimentNameGlobal = experimentName; winningVariantNameGlobal = variantName; }; let winSubscription = emitter.addWinListener(experimentName, winCallback); @@ -97,8 +97,8 @@ describe("Emitter", function() { }; let experimentNameGlobal = null; let winningVariantNameGlobal = null; - let winCallbackGlobal = function(expirimentName, variantName){ - experimentNameGlobal = expirimentName; + let winCallbackGlobal = function(experimentName, variantName){ + experimentNameGlobal = experimentName; winningVariantNameGlobal = variantName; }; let winSubscription = emitter.addWinListener(experimentName, winCallback); @@ -134,8 +134,8 @@ describe("Emitter", function() { }; let experimentNameGlobal = null; let activeVariantNameGlobal = null; - let activeVariantCallbackGlobal = function(expirimentName, variantName){ - experimentNameGlobal = expirimentName; + let activeVariantCallbackGlobal = function(experimentName, variantName){ + experimentNameGlobal = experimentName; activeVariantNameGlobal = variantName; }; let activeVariantSubscription = emitter.addActiveVariantListener(experimentName, activeVariantCallback); diff --git a/test/browser/experiment.test.jsx b/test/browser/experiment.test.jsx index 2d5d010..03d1d5c 100644 --- a/test/browser/experiment.test.jsx +++ b/test/browser/experiment.test.jsx @@ -245,8 +245,8 @@ describe("Experiment", function() { }; let experimentNameGlobal = null; let winningVariantNameGlobal = null; - let winCallbackGlobal = function(expirimentName, variantName){ - experimentNameGlobal = expirimentName; + let winCallbackGlobal = function(experimentName, variantName){ + experimentNameGlobal = experimentName; winningVariantNameGlobal = variantName; }; let winSubscription = emitter.addWinListener(experimentName, winCallback);