Merge pull request #704 from quickcue/modules
Fix gh-407: added recommended UMD syntax to raphael for AMD support.
This commit is contained in:
commit
e0b94fdc04
|
|
@ -8,10 +8,30 @@ Visit the library website for more information: [http://raphaeljs.com](http://ra
|
|||
* `git submodule init && git submodule update && npm install`
|
||||
(thank you [Wes Tood](https://github.com/wesleytodd))
|
||||
|
||||
### Dependencies
|
||||
## Dependencies
|
||||
* [uglifyjs](https://github.com/mishoo/UglifyJS)
|
||||
* [eve](https://github.com/adobe-webplatform/eve)
|
||||
|
||||
## Loading
|
||||
Raphael can be loaded in a script tag or with AMD:
|
||||
|
||||
```js
|
||||
define([ "raphael" ], function( Raphael ) {
|
||||
console.log( Raphael );
|
||||
});
|
||||
```
|
||||
|
||||
To place raphael in a directory that is not your AMD's loader's base URL, adjust the path to raphael.
|
||||
|
||||
```js
|
||||
// requirejs syntax
|
||||
require.config({
|
||||
paths: {
|
||||
raphael: "libs/raphael"
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
At the moment we have 4 milestones:
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -5,7 +5,19 @@
|
|||
// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\
|
||||
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
|
||||
// └─────────────────────────────────────────────────────────────────────┘ \\
|
||||
(function () {
|
||||
(function (glob, factory) {
|
||||
// AMD support
|
||||
if (typeof define === "function" && define.amd) {
|
||||
// Define as named module for the sake of raphael.svg.js and raphael.vml.js
|
||||
// Adjust AMD paths if needed
|
||||
// example:
|
||||
// require.config({ paths: { raphael: "libs/raphael" } });
|
||||
define("raphael", ["eve"], factory);
|
||||
} else {
|
||||
// Browser globals (glob is window)
|
||||
glob.Raphael = factory(glob.eve);
|
||||
}
|
||||
}(this, function (eve) {
|
||||
/*\
|
||||
* Raphael
|
||||
[ method ]
|
||||
|
|
@ -5244,4 +5256,6 @@
|
|||
eve.on("raphael.DOMload", function () {
|
||||
loaded = true;
|
||||
});
|
||||
})();
|
||||
|
||||
return R;
|
||||
}));
|
||||
|
|
|
|||
51
raphael.js
51
raphael.js
|
|
@ -385,7 +385,19 @@
|
|||
// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\
|
||||
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
|
||||
// └─────────────────────────────────────────────────────────────────────┘ \\
|
||||
(function () {
|
||||
(function (glob, factory) {
|
||||
// AMD support
|
||||
if (typeof define === "function" && define.amd) {
|
||||
// Define as named module for the sake of raphael.svg.js and raphael.vml.js
|
||||
// Adjust AMD paths if needed
|
||||
// example:
|
||||
// require.config({ paths: { raphael: "libs/raphael" } });
|
||||
define("raphael", ["eve"], factory);
|
||||
} else {
|
||||
// Browser globals (glob is window)
|
||||
glob.Raphael = factory(glob.eve);
|
||||
}
|
||||
}(this, function (eve) {
|
||||
/*\
|
||||
* Raphael
|
||||
[ method ]
|
||||
|
|
@ -5624,7 +5636,9 @@
|
|||
eve.on("raphael.DOMload", function () {
|
||||
loaded = true;
|
||||
});
|
||||
})();
|
||||
|
||||
return R;
|
||||
}));
|
||||
|
||||
// ┌─────────────────────────────────────────────────────────────────────┐ \\
|
||||
// │ Raphaël - JavaScript Vector Library │ \\
|
||||
|
|
@ -5635,7 +5649,19 @@
|
|||
// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\
|
||||
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
|
||||
// └─────────────────────────────────────────────────────────────────────┘ \\
|
||||
window.Raphael && window.Raphael.svg && function (R) {
|
||||
(function (glob, factory) {
|
||||
// AMD support
|
||||
if (typeof define === "function" && define.amd) {
|
||||
// Require Raphael
|
||||
require(["raphael"], factory);
|
||||
} else if (glob.Raphael) {
|
||||
// Browser globals (glob is window)
|
||||
factory(glob.Raphael);
|
||||
}
|
||||
}(this, function (R) {
|
||||
if (!R.svg) {
|
||||
return;
|
||||
}
|
||||
var has = "hasOwnProperty",
|
||||
Str = String,
|
||||
toFloat = parseFloat,
|
||||
|
|
@ -6985,7 +7011,8 @@ window.Raphael && window.Raphael.svg && function (R) {
|
|||
};
|
||||
})(method);
|
||||
}
|
||||
}(window.Raphael);
|
||||
}));
|
||||
|
||||
// ┌─────────────────────────────────────────────────────────────────────┐ \\
|
||||
// │ Raphaël - JavaScript Vector Library │ \\
|
||||
// ├─────────────────────────────────────────────────────────────────────┤ \\
|
||||
|
|
@ -6995,7 +7022,19 @@ window.Raphael && window.Raphael.svg && function (R) {
|
|||
// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\
|
||||
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
|
||||
// └─────────────────────────────────────────────────────────────────────┘ \\
|
||||
window.Raphael && window.Raphael.vml && function (R) {
|
||||
(function (glob, factory) {
|
||||
// AMD support
|
||||
if (typeof define === "function" && define.amd) {
|
||||
// Require Raphael
|
||||
require(["raphael"], factory);
|
||||
} else if (glob.Raphael) {
|
||||
// Browser globals (glob is window)
|
||||
factory(glob.Raphael);
|
||||
}
|
||||
}(this, function (R) {
|
||||
if (!R.vml) {
|
||||
return;
|
||||
}
|
||||
var has = "hasOwnProperty",
|
||||
Str = String,
|
||||
toFloat = parseFloat,
|
||||
|
|
@ -7958,4 +7997,4 @@ window.Raphael && window.Raphael.vml && function (R) {
|
|||
};
|
||||
})(method);
|
||||
}
|
||||
}(window.Raphael);
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -7,7 +7,19 @@
|
|||
// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\
|
||||
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
|
||||
// └─────────────────────────────────────────────────────────────────────┘ \\
|
||||
window.Raphael && window.Raphael.svg && function (R) {
|
||||
(function (glob, factory) {
|
||||
// AMD support
|
||||
if (typeof define === "function" && define.amd) {
|
||||
// Require Raphael
|
||||
require(["raphael"], factory);
|
||||
} else if (glob.Raphael) {
|
||||
// Browser globals (glob is window)
|
||||
factory(glob.Raphael);
|
||||
}
|
||||
}(this, function (R) {
|
||||
if (!R.svg) {
|
||||
return;
|
||||
}
|
||||
var has = "hasOwnProperty",
|
||||
Str = String,
|
||||
toFloat = parseFloat,
|
||||
|
|
@ -1357,4 +1369,4 @@ window.Raphael && window.Raphael.svg && function (R) {
|
|||
};
|
||||
})(method);
|
||||
}
|
||||
}(window.Raphael);
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -7,7 +7,19 @@
|
|||
// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\
|
||||
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
|
||||
// └─────────────────────────────────────────────────────────────────────┘ \\
|
||||
window.Raphael && window.Raphael.vml && function (R) {
|
||||
(function (glob, factory) {
|
||||
// AMD support
|
||||
if (typeof define === "function" && define.amd) {
|
||||
// Require Raphael
|
||||
require(["raphael"], factory);
|
||||
} else if (glob.Raphael) {
|
||||
// Browser globals (glob is window)
|
||||
factory(glob.Raphael);
|
||||
}
|
||||
}(this, function (R) {
|
||||
if (!R.vml) {
|
||||
return;
|
||||
}
|
||||
var has = "hasOwnProperty",
|
||||
Str = String,
|
||||
toFloat = parseFloat,
|
||||
|
|
@ -970,4 +982,4 @@ window.Raphael && window.Raphael.vml && function (R) {
|
|||
};
|
||||
})(method);
|
||||
}
|
||||
}(window.Raphael);
|
||||
}));
|
||||
Loading…
Reference in New Issue