diff --git a/HISTORY.md b/HISTORY.md index c859d549..d9085c83 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,7 +2,22 @@ http://visjs.org -## not yet released, version 2.0.0 +## 2014-06-19, version 2.0.1 + +### Timeline + +- Throws an error when constructing without new keyword. + +### Graph + +- Throws an error when constructing without new keyword. + +### Graph3d + +- Throws an error when constructing without new keyword. + + +## 2014-06-19, version 2.0.0 ### Timeline diff --git a/src/graph/Graph.js b/src/graph/Graph.js index ee68da20..084d2261 100644 --- a/src/graph/Graph.js +++ b/src/graph/Graph.js @@ -10,6 +10,9 @@ * @param {Object} options Options */ function Graph (container, data, options) { + if (!(this instanceof Graph)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } this._initializeMixinLoaders(); diff --git a/src/graph3d/Graph3d.js b/src/graph3d/Graph3d.js index 21e3f5d1..c246b380 100644 --- a/src/graph3d/Graph3d.js +++ b/src/graph3d/Graph3d.js @@ -10,6 +10,10 @@ * @param {Object} [options] */ function Graph3d(container, data, options) { + if (!(this instanceof Graph3d)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } + // create variables and set default values this.containerElement = container; this.width = '400px'; diff --git a/src/timeline/Timeline.js b/src/timeline/Timeline.js index 38299f77..9706bc96 100644 --- a/src/timeline/Timeline.js +++ b/src/timeline/Timeline.js @@ -6,6 +6,10 @@ * @constructor */ function Timeline (container, items, options) { + if (!(this instanceof Timeline)) { + throw new SyntaxError('Constructor must be called with the new operator'); + } + var me = this; this.defaultOptions = { start: null,