From 7114d5ccc9f6b9739137b517b6ecb9b024c410a9 Mon Sep 17 00:00:00 2001 From: jos Date: Wed, 14 Jan 2015 11:44:54 +0100 Subject: [PATCH] Added es5 to es6 transpilation step to the build script, so now we can use ES6 :) --- gulpfile.js | 7 +++++-- lib/timeline/Core.js | 12 +++--------- package.json | 2 ++ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index fc75fc35..84412653 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -34,7 +34,6 @@ var bannerPlugin = new webpack.BannerPlugin(createBanner(), { raw: true }); -// TODO: the moment.js language files should be excluded by default (they are quite big) var webpackConfig = { entry: ENTRY, output: { @@ -44,8 +43,12 @@ var webpackConfig = { filename: VIS_JS, sourcePrefix: ' ' }, - // exclude requires of moment.js language files module: { + loaders: [ + { test: /\.js$/, exclude: /node_modules/, loader: '6to5-loader'} + ], + + // exclude requires of moment.js language files wrappedContextRegExp: /$^/ }, plugins: [ bannerPlugin ], diff --git a/lib/timeline/Core.js b/lib/timeline/Core.js index 72427352..140bc10a 100644 --- a/lib/timeline/Core.js +++ b/lib/timeline/Core.js @@ -214,9 +214,7 @@ Core.prototype.setOptions = function (options) { } // propagate options to all components - this.components.forEach(function (component) { - component.setOptions(options); - }); + this.components.forEach(component => component.setOptions(options)); // TODO: remove deprecation error one day (deprecated since version 0.8.0) if (options && options.order) { @@ -270,9 +268,7 @@ Core.prototype.destroy = function () { this.hammer = null; // give all components the opportunity to cleanup - this.components.forEach(function (component) { - component.destroy(); - }); + this.components.forEach(component => component.destroy()); this.body = null; }; @@ -336,9 +332,7 @@ Core.prototype.clear = function(what) { // clear options of timeline and of each of the components if (!what || what.options) { - this.components.forEach(function (component) { - component.setOptions(component.defaultOptions); - }); + this.components.forEach(component => component.setOptions(component.defaultOptions)); this.setOptions(this.defaultOptions); // this will also do a redraw } diff --git a/package.json b/package.json index cd6db5c5..c97efb0b 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,8 @@ "keycharm": "^0.2.0" }, "devDependencies": { + "6to5": "^2.12.2", + "6to5-loader": "^2.0.0", "clean-css": "latest", "gulp": "^3.8.5", "gulp-concat": "^2.2.0",