From a2b7f9fc114567c240e0d49aa05ac8d2bf10bea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 16 Aug 2014 19:11:16 +0200 Subject: [PATCH] Remove __options.stats and load Stats library automatically only when in dev mode on the browser. --- src/load.js | 1 - src/options.js | 6 +----- src/paper.js | 26 +++++++++++++------------- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/load.js b/src/load.js index fef9e216..60d64acd 100644 --- a/src/load.js +++ b/src/load.js @@ -44,7 +44,6 @@ if (typeof window === 'object') { prepro.setOptions({ environment: 'node', legacy: false, - stats: false, version: 'dev' }); // Load Paper.js library files. diff --git a/src/options.js b/src/options.js index d274f54c..7287d73b 100644 --- a/src/options.js +++ b/src/options.js @@ -19,11 +19,9 @@ // publishes the various JSON package files automatically. var version = '0.9.19'; -var inBrowser = typeof window === 'object'; - var __options = { // If this file is loaded in the browser, we're in dev mode through load.js - version: inBrowser ? 'dev' : version, + version: typeof window === 'object' ? 'dev' : version, environment: 'browser', parser: 'acorn', legacy: true, @@ -33,7 +31,5 @@ var __options = { nativeContains: false, paperScript: true, palette: true, - // Only load stats when in dev mode - stats: inBrowser, debug: false }; diff --git a/src/paper.js b/src/paper.js index 50709922..b0c6d47b 100644 --- a/src/paper.js +++ b/src/paper.js @@ -36,17 +36,17 @@ var paper = new function(undefined) { // Inline Straps.js core (the Base class) inside the paper scope first: /*#*/ include('../bower_components/straps/straps.js', { exports: false }); -/*#*/ if (__options.stats) { +/*#*/ if (__options.version == 'dev' && __options.environment == 'browser') { /*#*/ include('../bower_components/stats.js/build/stats.min.js'); -/*#*/ } // __options.stats +/*#*/ } /*#*/ if (__options.legacy) { - /*#*/ include('legacy.js'); -/*#*/ } // __options.legacy +/*#*/ include('legacy.js'); +/*#*/ } /*#*/ if (__options.version == 'dev') { /*#*/ include('constants.js'); -/*#*/ } // __options.version == 'dev' +/*#*/ } /*#*/ include('core/Base.js'); /*#*/ include('core/Callback.js'); @@ -87,7 +87,7 @@ var paper = new function(undefined) { /*#*/ include('path/CompoundPath.js'); /*#*/ if (__options.booleanOperations) { /*#*/ include('path/PathItem.Boolean.js'); -/*#*/ } // __options.booleanOperations +/*#*/ } /*#*/ include('path/PathFlattener.js'); /*#*/ include('path/PathFitter.js'); @@ -101,12 +101,12 @@ var paper = new function(undefined) { /*#*/ if (__options.environment == 'node') { /*#*/ include('dom/node.js'); -/*#*/ } // __options.environment == 'node' +/*#*/ } /*#*/ include('dom/DomElement.js'); /*#*/ if (__options.environment == 'browser') { // DomEvent doesn't make sense outside of the browser (yet) /*#*/ include('dom/DomEvent.js'); -/*#*/ } // __options.environment == 'browser' +/*#*/ } /*#*/ include('ui/View.js'); /*#*/ include('ui/CanvasView.js'); @@ -120,7 +120,7 @@ var paper = new function(undefined) { /*#*/ if (__options.palette) { /*#*/ include('ui/Palette.js'); /*#*/ include('ui/Component.js'); -/*#*/ } // __options.palette +/*#*/ } /*#*/ include('tool/ToolEvent.js'); /*#*/ include('tool/Tool.js'); @@ -128,25 +128,25 @@ var paper = new function(undefined) { // Http is used both for PaperScript and SVGImport /*#*/ if (__options.paperScript || __options.svg) { /*#*/ include('net/Http.js'); -/*#*/ } // __options.paperScript || __options.svg +/*#*/ } /*#*/ } // __options.environment == 'browser' /*#*/ include('canvas/CanvasProvider.js'); /*#*/ include('canvas/BlendMode.js'); /*#*/ if (__options.version == 'dev') { /*#*/ include('canvas/ProxyContext.js'); -/*#*/ } // __options.environment == 'browser' +/*#*/ } /*#*/ if (__options.svg) { /*#*/ include('svg/SVGStyles.js'); /*#*/ include('svg/SVGNamespaces.js'); /*#*/ include('svg/SVGExport.js'); /*#*/ include('svg/SVGImport.js'); -/*#*/ } // __options.svg +/*#*/ } /*#*/ if (__options.paperScript) { /*#*/ include('core/PaperScript.js'); -/*#*/ } // __options.paperScript +/*#*/ } /*#*/ include('export.js'); return paper;