Permalink
Browse files

Merge pull request #2 from Siedrix/master

Now with requirejs support
  • Loading branch information...
2 parents 8b9e5ba + 3d36b70 commit 50235f65ecd11e2b1ab4e71461fe2f2514216b8e @azendal committed Feb 1, 2012
Showing with 26 additions and 6 deletions.
  1. +22 −4 neon.js
  2. +4 −2 node.js
View
@@ -47,7 +47,9 @@
*/
(function (global){
-global.Interface = function Interface(nameOrNameSpace, name){
+var Neon = {};
+
+Neon.Interface = function Interface(nameOrNameSpace, name){
var nameSpace, interfaceName, factory;
nameSpace = (nameOrNameSpace && name) ? nameOrNameSpace : this;
interfaceName = (nameOrNameSpace && name) ? name :
@@ -61,7 +63,7 @@ global.Interface = function Interface(nameOrNameSpace, name){
return factory;
};
-global.Module = function Module(nameOrNameSpace, name){
+Neon.Module = function Module(nameOrNameSpace, name){
var nameSpace, moduleName, factory;
nameSpace = (nameOrNameSpace && name) ? nameOrNameSpace : this;
moduleName = (nameOrNameSpace && name) ? name :
@@ -74,7 +76,7 @@ global.Module = function Module(nameOrNameSpace, name){
return factory;
};
-global.Class = function Class(classNameOrNameSpace, className){
+Neon.Class = function Class(classNameOrNameSpace, className){
var nameSpace, newClass, classFactory;
nameSpace = (classNameOrNameSpace && className) ? classNameOrNameSpace : this;
className = (classNameOrNameSpace && className) ? className :
@@ -196,6 +198,22 @@ global.Class = function Class(classNameOrNameSpace, className){
};
return classFactory;
+
};
-}(typeof window === 'undefined' ? exports : window));
+if (typeof define === 'function') {
+ define(function() {
+ return Neon;
+ });
+} else {
+ if(typeof process !== 'undefined'){
+ global.Neon = Neon;
+ }else{
+ global.Class = Neon.Class;
+ global.Module = Neon.Module;
+ global.Interface = Neon.Interface;
+ }
+}
+
+}(typeof window !== 'undefined' ? window : (typeof exports !== 'undefined' ? exports : null) ));
+
View
@@ -1,4 +1,6 @@
-var Neon = require('./neon.js');
+var Neon = require('./neon.js').Neon;
+
+console.log(Neon);
console.log('Neon Class :',typeof Neon.Class);
console.log('Neon Module :',typeof Neon.Module);
@@ -8,7 +10,7 @@ var Class = Neon.Class;
var Module = Neon.Module;
var Interface = Neon.Interface;
-console.log('Neon Class :',typeof Class);
+console.log('Class :',typeof Class);
console.log('Module :',typeof Module);
console.log('Interface :',typeof Interface);

0 comments on commit 50235f6

Please sign in to comment.