Skip to content

Commit dd70429

Browse files
Disable console warnings by default
1 parent af97480 commit dd70429

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

docs/api/shape.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,12 @@ with CSS.
143143
to: { color: '#000' },
144144
step: function(state, circle, attachment) {
145145
circle.path.setAttribute('stroke', state.color);
146-
}
146+
},
147+
148+
// If true, some useful console.warn calls will be done if it seems
149+
// that progressbar is used incorrectly
150+
// Default: false
151+
warnings: false
147152
}
148153
```
149154

src/shape.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ var Shape = function Shape(container, opts) {
5050
svgStyle: {
5151
display: 'block',
5252
width: '100%'
53-
}
53+
},
54+
warnings: false
5455
}, opts, true); // Use recursive extend
5556

5657
// If user specifies e.g. svgStyle or text style, the whole object
@@ -77,7 +78,9 @@ var Shape = function Shape(container, opts) {
7778

7879
this._container = element;
7980
this._container.appendChild(svgView.svg);
80-
this._warnContainerAspectRatio(this._container);
81+
if (this._opts.warnings) {
82+
this._warnContainerAspectRatio(this._container);
83+
}
8184

8285
if (this._opts.svgStyle) {
8386
utils.setStyles(svgView.svg, this._opts.svgStyle);
@@ -296,7 +299,7 @@ Shape.prototype._warnContainerAspectRatio = function _warnContainerAspectRatio(c
296299
if (!utils.floatEquals(this.containerAspectRatio, width / height)) {
297300
console.warn(
298301
'Incorrect aspect ratio of container',
299-
this._container,
302+
'#' + container.id,
300303
'detected:',
301304
computedStyle.getPropertyValue('width') + '(width)',
302305
'/',

0 commit comments

Comments
 (0)