mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-12 22:18:54 -04:00
Improve CommonJS support a bit.
This commit is contained in:
parent
652dbe1e86
commit
4fab100e71
1 changed files with 9 additions and 6 deletions
|
@ -26,14 +26,17 @@ paper = new (PaperScope.inject(Base.exports, {
|
||||||
Key: Key
|
Key: Key
|
||||||
}))();
|
}))();
|
||||||
|
|
||||||
// Support AMD (e.g. require.js)
|
if (typeof define === 'function' && define.amd) {
|
||||||
// Use named module AMD syntax since there are other unnamed calls to define()
|
// Support AMD (e.g. require.js)
|
||||||
// inside the built library (from inlined Acorn / Esprima) that apparently
|
// Use named module AMD syntax since there are other unnamed calls to
|
||||||
// confuse the require.js optimizer.
|
// define() inside the built library (from inlined Acorn / Esprima) that
|
||||||
if (typeof define === 'function' && define.amd)
|
// apparently confuse the require.js optimizer.
|
||||||
define('paper', paper);
|
define('paper', paper);
|
||||||
else if (typeof module === 'object')
|
} else if (typeof module === 'object' && module // could be `null`
|
||||||
|
&& typeof module.exports === 'object') {
|
||||||
|
// Support CommonJS module
|
||||||
module.exports = paper;
|
module.exports = paper;
|
||||||
|
}
|
||||||
|
|
||||||
/*#*/ } else if (__options.environment == 'node') {
|
/*#*/ } else if (__options.environment == 'node') {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue