projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use link href, not link src (#904)
[dygraphs.git]
/
src
/
dygraph-options.js
diff --git
a/src/dygraph-options.js
b/src/dygraph-options.js
index
8affcdf
..
7c7f745
100644
(file)
--- a/
src/dygraph-options.js
+++ b/
src/dygraph-options.js
@@
-11,11
+11,11
@@
// TODO: remove this jshint directive & fix the warnings.
/*jshint sub:true */
// TODO: remove this jshint directive & fix the warnings.
/*jshint sub:true */
-/*global Dygraph:false */
"use strict";
import * as utils from './dygraph-utils';
import DEFAULT_ATTRS from './dygraph-default-attrs';
"use strict";
import * as utils from './dygraph-utils';
import DEFAULT_ATTRS from './dygraph-default-attrs';
+import OPTIONS_REFERENCE from './dygraph-options-reference';
/*
* Interesting member variables: (REMOVING THIS LIST AS I CLOSURIZE)
/*
* Interesting member variables: (REMOVING THIS LIST AS I CLOSURIZE)
@@
-166,7
+166,12
@@
DygraphOptions.prototype.reparseSeries = function() {
}
utils.update(this.xAxis_.options, axis_opts["x"] || {});
}
utils.update(this.xAxis_.options, axis_opts["x"] || {});
- // if (DEBUG) this.validateOptions_();
+ // For "production" code, this gets removed by uglifyjs.
+ if (typeof(process) !== 'undefined') {
+ if (process.env.NODE_ENV != 'production') {
+ this.validateOptions_();
+ }
+ }
};
/**
};
/**
@@
-322,23
+327,23
@@
DygraphOptions.prototype.seriesNames = function() {
return this.labels_;
};
return this.labels_;
};
-//
TODO: fix this
-
// if (DEBUG
) {
-if (
false
) {
+//
For "production" code, this gets removed by uglifyjs.
+
if (typeof(process) !== 'undefined'
) {
+if (
process.env.NODE_ENV != 'production'
) {
/**
* Validate all options.
/**
* Validate all options.
- * This requires
Dygraph.
OPTIONS_REFERENCE, which is only available in debug builds.
+ * This requires OPTIONS_REFERENCE, which is only available in debug builds.
* @private
*/
DygraphOptions.prototype.validateOptions_ = function() {
* @private
*/
DygraphOptions.prototype.validateOptions_ = function() {
- if (typeof
Dygraph.
OPTIONS_REFERENCE === 'undefined') {
+ if (typeof OPTIONS_REFERENCE === 'undefined') {
throw 'Called validateOptions_ in prod build.';
}
var that = this;
var validateOption = function(optionName) {
throw 'Called validateOptions_ in prod build.';
}
var that = this;
var validateOption = function(optionName) {
- if (!
Dygraph.
OPTIONS_REFERENCE[optionName]) {
+ if (!OPTIONS_REFERENCE[optionName]) {
that.warnInvalidOption_(optionName);
}
};
that.warnInvalidOption_(optionName);
}
};
@@
-382,8
+387,8
@@
DygraphOptions.prototype.warnInvalidOption_ = function(optionName) {
console.warn('Use new-style per-series options (saw ' + optionName + ' as top-level options key). See http://bit.ly/1tceaJs');
} else {
console.warn('Unknown option ' + optionName + ' (full list of options at dygraphs.com/options.html');
console.warn('Use new-style per-series options (saw ' + optionName + ' as top-level options key). See http://bit.ly/1tceaJs');
} else {
console.warn('Unknown option ' + optionName + ' (full list of options at dygraphs.com/options.html');
- throw "invalid option " + optionName;
}
}
+ throw "invalid option " + optionName;
}
};
}
};
@@
-393,5
+398,6
@@
DygraphOptions.resetWarnings_ = function() {
};
}
};
}
+}
export default DygraphOptions;
export default DygraphOptions;