mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Let paper be an instance of Base, and use its #extend() function to create scopes that inherit from paper but do not directly modify it.
This commit is contained in:
parent
2c78a0a08b
commit
0b3c57ff88
2 changed files with 5 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
var paper = {
|
||||
var paper = new Base().inject({
|
||||
document: null,
|
||||
documents: [],
|
||||
|
||||
|
@ -7,4 +7,4 @@ var paper = {
|
|||
scope[i] = paper[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
@ -4,7 +4,9 @@ var PaperScript = new function() {
|
|||
}
|
||||
|
||||
function run(code) {
|
||||
with (paper) {
|
||||
// Use paper.extend() to create a paper scope within which the code is
|
||||
// evaluated.
|
||||
with (paper.extend()) {
|
||||
return eval(compile(code));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue