mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-12 22:18:54 -04:00
Avoid use of 'window' for Node, and pass on reference to root scope instead.
This commit is contained in:
parent
94c192495a
commit
ec4f194b84
1 changed files with 6 additions and 6 deletions
|
@ -18,7 +18,7 @@
|
||||||
// main paper scope, and is added to the PaperScope class. This allows for
|
// main paper scope, and is added to the PaperScope class. This allows for
|
||||||
// better minification and the future use of strict mode once it makes sense
|
// better minification and the future use of strict mode once it makes sense
|
||||||
// in terms of performance.
|
// in terms of performance.
|
||||||
paper.PaperScope.prototype.PaperScript = new function() {
|
paper.PaperScope.prototype.PaperScript = (function(root) {
|
||||||
var Base = paper.Base,
|
var Base = paper.Base,
|
||||||
PaperScope = paper.PaperScope,
|
PaperScope = paper.PaperScope,
|
||||||
// Locally turn of exports and define for inlined acorn / esprima.
|
// Locally turn of exports and define for inlined acorn / esprima.
|
||||||
|
@ -27,10 +27,10 @@ paper.PaperScope.prototype.PaperScript = new function() {
|
||||||
// The scope into which the library is loaded.
|
// The scope into which the library is loaded.
|
||||||
scope = this;
|
scope = this;
|
||||||
/*#*/ if (options.version == 'dev') {
|
/*#*/ if (options.version == 'dev') {
|
||||||
// As the above inclusion loads code into the global scope during dev,
|
// As the above inclusion loads code into the root scope during dev,
|
||||||
// set scope to window, so we can find the library.
|
// set scope to root, so we can find the library.
|
||||||
scope = window;
|
scope = root;
|
||||||
/*#*/ }
|
/*#*/ } // options.version == 'dev'
|
||||||
/*#*/ if (options.parser == 'acorn') {
|
/*#*/ if (options.parser == 'acorn') {
|
||||||
/*#*/ include('../../components/acorn/acorn.min.js', { exports: false });
|
/*#*/ include('../../components/acorn/acorn.min.js', { exports: false });
|
||||||
/*#*/ } else if (options.parser == 'esprima') {
|
/*#*/ } else if (options.parser == 'esprima') {
|
||||||
|
@ -375,4 +375,4 @@ paper.PaperScope.prototype.PaperScript = new function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*#*/ } // !options.browser
|
/*#*/ } // !options.browser
|
||||||
};
|
})(this);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue