Skip to content

Instantly share code, notes, and snippets.

@canonic-epicure
Created April 22, 2010 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save canonic-epicure/375198 to your computer and use it in GitHub Desktop.
Save canonic-epicure/375198 to your computer and use it in GitHub Desktop.
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