diff --git a/lib/timeline/Graph2d.js b/lib/timeline/Graph2d.js index 004305ea..66288f93 100644 --- a/lib/timeline/Graph2d.js +++ b/lib/timeline/Graph2d.js @@ -16,14 +16,9 @@ var LineGraph = require('./component/LineGraph'); * @param {vis.DataSet | Array | google.visualization.DataTable} [items] * @param {Object} [options] See Graph2d.setOptions for the available options. * @constructor + * @extends Core */ function Graph2d (container, items, options, groups) { - for (var coreProp in Core.prototype) { - if (Core.prototype.hasOwnProperty(coreProp) && !Graph2d.prototype.hasOwnProperty(coreProp)) { - Graph2d.prototype[coreProp] = Core.prototype[coreProp]; - } - } - var me = this; this.defaultOptions = { start: null, @@ -107,6 +102,9 @@ function Graph2d (container, items, options, groups) { } } +// Extend the functionality from Core +Graph2d.prototype = new Core(); + /** * Set options. Options will be passed to all components loaded in the Graph2d. * @param {Object} [options] diff --git a/lib/timeline/Timeline.js b/lib/timeline/Timeline.js index b597dc62..670b6636 100644 --- a/lib/timeline/Timeline.js +++ b/lib/timeline/Timeline.js @@ -16,15 +16,9 @@ var ItemSet = require('./component/ItemSet'); * @param {vis.DataSet | Array | google.visualization.DataTable} [items] * @param {Object} [options] See Timeline.setOptions for the available options. * @constructor + * @extends Core */ function Timeline (container, items, options) { - // mix the core properties in here - for (var coreProp in Core.prototype) { - if (Core.prototype.hasOwnProperty(coreProp) && !Timeline.prototype.hasOwnProperty(coreProp)) { - Timeline.prototype[coreProp] = Core.prototype[coreProp]; - } - } - if (!(this instanceof Timeline)) { throw new SyntaxError('Constructor must be called with the new operator'); } @@ -107,6 +101,9 @@ function Timeline (container, items, options) { } } +// Extend the functionality from Core +Timeline.prototype = new Core(); + /** * Set options. Options will be passed to all components loaded in the Timeline. * @param {Object} [options] @@ -135,7 +132,7 @@ function Timeline (container, items, options) { Timeline.prototype.setOptions = function (options) { if (options) { // copy the known options - var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'orientation']; + var fields = ['width', 'height', 'minHeight', 'maxHeight', 'autoResize', 'start', 'end', 'orientation', 'activatable']; util.selectiveExtend(fields, this.options, options); // enable/disable autoResize