Commit 7fd4df74 authored by Tomas Alabes's avatar Tomas Alabes

Requirejs and global working

parent d6b6f769
......@@ -16,7 +16,7 @@ module.exports = function(grunt) {
},
dist: {
src: "<%= concat.dist.dest %>",
dest: "dev/raphael-min.js"
dest: "raphael-min.js"
}
},
replace: {
......@@ -39,7 +39,7 @@ module.exports = function(grunt) {
dist: {
dest: "<%= pkg.name %>.js",
src: [
"../node_modules/eve/eve.js",
"node_modules/eve/eve.js",
"dev/raphael.core.js",
"dev/raphael.svg.js",
"dev/raphael.vml.js",
......
......@@ -5,6 +5,9 @@
"dependencies": {
"eve": "git://github.com/adobe-webplatform/eve.git#eef80ed"
},
"devDependencies": {
"requirejs": "~2.1.17"
},
"ignore": [
"eve",
"**/.*",
......
......@@ -8,7 +8,7 @@ require.config({
require(['raphael'], function(Raphael) {
var paper = Raphael(0, 0, 640, 720, "container");
//paper.circle(100, 100, 100); //example
paper.circle(100, 100, 100); //example
// Work here
});
var core = require('./raphael.core');
if(core.svg){
require('./raphael.svg');
}
if(core.vml){
require('./raphael.vml');
}
module.exports = core;
\ No newline at end of file
// ┌────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël @VERSION - JavaScript Vector Library │ \\
// │ Raphaël @@VERSION - JavaScript Vector Library │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\
// │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\
......@@ -10,7 +10,7 @@
(function (glob, factory) {
if (typeof define === "function" && define.amd) {
define("raphael", ["raphael.core", "raphael.svg", "raphael.vml"], function(Raphael) {
return (glob.Raphael = factory(Raphael));
return factory(Raphael);
});
} else if (typeof exports === "object") {
var raphael = require("raphael.core");
......@@ -20,7 +20,7 @@
module.exports = factory(raphael);
} else {
glob.Raphael = factory(glob.Raphael);
//glob.Raphael = factory(glob.Raphael);
}
}(this, function (Raphael) {
return Raphael.ninja();
......
// ┌────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël @@VERSION - JavaScript Vector Library │ \\
// │ Raphaël @@VERSION - JavaScript Vector Library │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ Core Module │ \\
// │ Core Module │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
// └────────────────────────────────────────────────────────────────────┘ \\
......@@ -5354,7 +5354,7 @@
[ method ]
**
* If you want to leave no trace of Raphaël (Well, Raphaël creates only one global variable `Raphael`, but anyway.) You can use `ninja` method.
* Beware, that in this case plugins could stop working, because they are depending on global variable existance.
* Beware, that in this case plugins could stop working, because they are depending on global variable existence.
**
= (object) Raphael object
> Usage
......
// ┌─────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël @@VERSION - JavaScript Vector Library │ \\
// │ Raphaël @@VERSION - JavaScript Vector Library │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ SVG Module │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
......@@ -11,7 +11,7 @@
(function (glob, factory) {
if (typeof define === "function" && define.amd) {
define("raphael.svg", ["raphael.core"], function(raphael) {
factory(raphael);
return factory(raphael);
});
} else if (typeof exports === "object") {
factory(require("raphael.core"));
......@@ -657,7 +657,7 @@
* Element.id
[ property (number) ]
**
* Unique id of the element. Especially usesful when you want to listen to events of the element,
* Unique id of the element. Especially useful when you want to listen to events of the element,
* because all events are fired in format `<module>.<action>.<id>`. Also useful for @Paper.getById method.
\*/
this.id = R._oid++;
......
// ┌─────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël @@VERSION - JavaScript Vector Library │ \\
// │ Raphaël @@VERSION - JavaScript Vector Library │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ VML Module │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
......@@ -11,7 +11,7 @@
(function (glob, factory) {
if (typeof define === "function" && define.amd) {
define("raphael.vml", ["raphael.core"], function(raphael) {
factory(raphael);
return factory(raphael);
});
} else if (typeof exports === "object") {
factory(require("raphael"));
......
......@@ -6,8 +6,7 @@
<!-- Global use -->
<!-- Remember to run to pull the eve submodule -->
<!-- To work with concatenated version -->
<!-- To work with full version -->
<!--<script type="text/javascript" src="../raphael.js"></script>-->
<!-- To work with minified version -->
......@@ -15,24 +14,24 @@
<!-- To work with dev versions -->
<!-- Comment this 4 script tags if you are testing with AMD -->
<script type="text/javascript" src="../eve/eve.js"></script>
<script type="text/javascript" src="raphael.core.js"></script>
<script type="text/javascript" src="raphael.svg.js"></script>
<script type="text/javascript" src="raphael.vml.js"></script>
<script type="text/javascript" src="raphael.amd.js"></script>
<!--<script type="text/javascript" src="../node_modules/eve/eve.js"></script>-->
<!--<script type="text/javascript" src="raphael.core.js"></script>-->
<!--<script type="text/javascript" src="raphael.svg.js"></script>-->
<!--<script type="text/javascript" src="raphael.vml.js"></script>-->
<!--<script type="text/javascript" src="raphael.amd.js"></script>-->
<!-- Comment this script tag if you are testing with AMD -->
<script type="text/javascript">
<!--<script type="text/javascript">
// Initialize container when document is loaded
window.onload = function () {
paper = Raphael(0, 0, 640, 720, "container");
//paper.circle(100, 100, 100); //example
paper.circle(100, 100, 100); //example
};
//Work here, in a separate script file or via command line
</script>
</script>-->
<!-- AMD use -->
<!--<script data-main="amdDev" src="require.js"></script>-->
<script data-main="amdDev" src="require.js"></script>
<!-- Use amdDev.js to work with AMD and Raphael -->
</head>
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment