From b99d54f8c3c3d53abf6a32277d020a6ca58ec79d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Tue, 11 Jun 2013 23:50:59 -0700 Subject: [PATCH] Add support for AMD (e.g. require.js) Fixes #223. --- src/core/PaperScript.js | 2 ++ src/paper.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/core/PaperScript.js b/src/core/PaperScript.js index 2e362cf9..bf8ba5a0 100644 --- a/src/core/PaperScript.js +++ b/src/core/PaperScript.js @@ -15,6 +15,8 @@ * @namespace */ +// Locally override define, so acorn.js does not export itself +var define = null; /*#*/ if (options.parser == 'acorn') { /*#*/ include('../../lib/acorn-min.js'); /*#*/ } else if (options.parser == 'esprima') { diff --git a/src/paper.js b/src/paper.js index abceb5a1..c8ce54a4 100644 --- a/src/paper.js +++ b/src/paper.js @@ -130,3 +130,7 @@ var paper = new function() { /*#*/ include('export.js'); return paper; }; + +// Support AMD (e.g. require.js) +if (define && define.amd) + define(paper);