Created
April 29, 2010 20:09
-
-
Save canonic-epicure/384165 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 - basic | |
Module('Graphic.Circle', function (module) { | |
// this == Graphic.Circle | |
// module == Graphic.Circle | |
var puts = require('sys').puts | |
// promotes module to class, leading dot means place it in global namespace | |
Class('.Graphic.Circle', { | |
has : { | |
radius : { | |
is : 'rw', | |
init : '123' | |
} | |
}, | |
methods : { | |
draw : function () { | |
puts("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