Created
April 22, 2010 13:10
-
-
Save canonic-epicure/375198 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = function (Joose, glob) { | |
eval("console.log(Joose)") | |
eval("console.log(glob())") | |
} | |
a('KindaJoose', function () { return 'exported glob' }) | |
console.log(window.glob, window.Joose) | |
// OpenJSAN 2.0 | |
Module('Some.Module', { | |
VERSION : 0.01, | |
AUTHORITY : 'SomeCleverGuy', | |
EXPORT : [ 'method1', 'method2' ], | |
use : { | |
'Path.Class' : 0.01, // exports 'file' and 'dir' | |
'Another.Module' : { version : 0.02, authority : 'AnotherCleverGuy', as : 'Alias' } | |
}, | |
body : function () { | |
this.method1 = function (fileName) { | |
file(fileName).save() // 'file' is imported from Path.Class | |
} | |
this.method2 = function (dirName) { | |
dir(fileName).save() | |
} | |
var obj = Another.Module[0.02]['AnotherCleverGuy'].create() // with `constructor.create()` instead of `new constructor` | |
var obj = Alias.create() // we can mask | |
var obj = new Another.Module[0.02]['AnotherCleverGuy']() // how to handle aliases for constructors | |
var obj = new Alias() // how to handle aliases for constructors | |
}}) | |
// Class means | |
Class('Some.Class', { | |
VERSION : 0.01, | |
AUTHORITY : 'SomeCleverGuy', | |
EXPORT : [ 'method1', 'method2' ], | |
use : { | |
'Joose' : { version : 3.01, as : 'Joose' }, | |
'Another.Module' : { version : 0.02, as : 'Alias' }, | |
'Path.Class' : 0.01 // exports 'file' and 'dir' | |
}, | |
body : function () { | |
Class({ | |
my : { | |
method1 : function () { | |
}, | |
method2 : function () { | |
} | |
} | |
}) | |
}}) | |
Module('Joose', { | |
VERSION : 3.01, | |
AUTHORITY : 'SomeCleverGuy', | |
EXPORT : [ 'Class', 'Role' ], | |
body : function () { | |
this.Class = function () { | |
} | |
this.Role = function () { | |
} | |
}}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment