Created
April 29, 2010 20:10
-
-
Save canonic-epicure/384166 to your computer and use it in GitHub Desktop.
This file contains 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
// ================================================ | |
// Using CommonJS modules in Joose - with dependencies | |
Module('Graphic.Circle', { | |
require : [ './some/commonjs/module1.js', './some/commonjs/module2.js' ], | |
use : { | |
'Some.Joose.Role' : 0.01, | |
'Some.Another.Class' : 0.02 | |
}, | |
body : function (module) { | |
// this == Graphic.Circle | |
// module == Graphic.Circle | |
// will be already loaded | |
var someFunc = require('./some/commonjs/module1.js').someFunc | |
Class('.Graphic.Circle', { | |
does : Some.Joose.Role, | |
has : { | |
radius : { | |
is : 'rw', | |
init : '123' | |
} | |
}, | |
methods : { | |
draw : function () { | |
someFunc1("using imported function") | |
} | |
} | |
}) | |
}}) | |
var circle = new Graphic.Circle() | |
circle.draw() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment