Explain reasons for /* jshint */ statements.

And consistently name Prepro.js
This commit is contained in:
Jürg Lehni 2016-01-16 15:37:02 +01:00
parent 00d2002b6f
commit 7783ebeed1
7 changed files with 10 additions and 10 deletions

View file

@ -143,7 +143,7 @@ And to go back to a built library
cd build cd build
./build.sh ./build.sh
Note that your PaperScripts examples do not need to change, they can keep loading `dist/paper-full.js`, which will always do the right thing. Note also that `src/load.js` handles both browsers and Node.js, through the handy PrePro JS preprocessing library <http://github.com/lehni/prepro.js>. Note that your PaperScripts examples do not need to change, they can keep loading `dist/paper-full.js`, which will always do the right thing. Note also that `src/load.js` handles both browsers and Node.js, through the handy Prepro.js preprocessing library <http://github.com/lehni/prepro.js>.
### Branch structure ### Branch structure

View file

@ -12,7 +12,7 @@
# This script simply creates symbolic links to src/load.js from # This script simply creates symbolic links to src/load.js from
# dist/paper-full.js and dist/paper-node.js, which loads the library from # dist/paper-full.js and dist/paper-node.js, which loads the library from
# separate sources through PrePro both in the browser and in Node.js. # separate sources through Prepro.js both in the browser and in Node.js.
if [ -f ../dist/paper-full.js ] if [ -f ../dist/paper-full.js ]
then then

View file

@ -14,7 +14,7 @@
* @name PaperScript * @name PaperScript
* @namespace * @namespace
*/ */
/* jshint -W082 */ /* jshint -W082 */// Do not complain about functions inside Prepro.js statements
Base.exports.PaperScript = (function() { Base.exports.PaperScript = (function() {
// Locally turn of exports and define for inlined acorn. // Locally turn of exports and define for inlined acorn.
// Just declaring the local vars is enough, as they will be undefined. // Just declaring the local vars is enough, as they will be undefined.

View file

@ -10,11 +10,11 @@
* All rights reserved. * All rights reserved.
*/ */
// This file uses PrePro to preprocess the paper.js source code on the fly in // This file uses Prepro.js to preprocess the paper.js source code on the fly in
// the browser, avoiding the step of having to manually preprocess it after each // the browser, avoiding the step of having to manually preprocess it after each
// change. This is very useful during development of the library itself. // change. This is very useful during development of the library itself.
if (typeof window === 'object') { if (typeof window === 'object') {
// Browser based loading through PrePro: // Browser based loading through Prepro.js:
if (!window.include) { if (!window.include) {
var scripts = document.getElementsByTagName('script'); var scripts = document.getElementsByTagName('script');
var src = scripts[scripts.length - 1].getAttribute('src'); var src = scripts[scripts.length - 1].getAttribute('src');
@ -22,7 +22,7 @@ if (typeof window === 'object') {
// through dist/paper-full.js, or directly through src/load.js, and // through dist/paper-full.js, or directly through src/load.js, and
// match root as all the parts of the path that lead to that folder. // match root as all the parts of the path that lead to that folder.
var root = src.match(/^(.*\/)\w*\//)[1]; var root = src.match(/^(.*\/)\w*\//)[1];
// First load the PrePro's browser.js file, which provides the include() // First load the prepro's browser.js file, which provides the include()
// function for the browser. // function for the browser.
document.write('<script type="text/javascript" src="' + root document.write('<script type="text/javascript" src="' + root
+ 'node_modules/prepro/lib/browser.js"></script>'); + 'node_modules/prepro/lib/browser.js"></script>');
@ -35,7 +35,7 @@ if (typeof window === 'object') {
include('paper.js'); include('paper.js');
} }
} else { } else {
// Node based loading through PrePro: // Node based loading through Prepro.js:
var prepro = require('prepro/lib/node.js'); var prepro = require('prepro/lib/node.js');
// Include deafult browser options. // Include deafult browser options.
// Step out and back into src in case this is loaded from dist/paper-node.js // Step out and back into src in case this is loaded from dist/paper-node.js

View file

@ -12,7 +12,7 @@
// Define __options for code preprocessing when building the library, as well as // Define __options for code preprocessing when building the library, as well as
// browser based compile-time preprocessing when loading the separate source // browser based compile-time preprocessing when loading the separate source
// files directly through load.js / prepro.js during development. // files directly through load.js / Prepro.js during development.
// The paper.js version. // The paper.js version.
// NOTE: Adjust value here before calling publish.sh, which then updates and // NOTE: Adjust value here before calling publish.sh, which then updates and

View file

@ -178,7 +178,7 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
}, },
setClockwise: function(clockwise) { setClockwise: function(clockwise) {
/* jshint -W018 */ /* jshint -W018 */// Don't complain about confusing use of !:
if (this.isClockwise() !== !!clockwise) if (this.isClockwise() !== !!clockwise)
this.reverse(); this.reverse();
}, },

View file

@ -19,7 +19,7 @@
* center, both useful for constructing artwork that should appear centered on * center, both useful for constructing artwork that should appear centered on
* screen. * screen.
*/ */
/* jshint -W082 */ /* jshint -W082 */// Do not complain about functions inside Prepro.js statements
var View = Base.extend(Emitter, /** @lends View# */{ var View = Base.extend(Emitter, /** @lends View# */{
_class: 'View', _class: 'View',