Skip to content

Instantly share code, notes, and snippets.

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/384165 to your computer and use it in GitHub Desktop.
Save canonic-epicure/384165 to your computer and use it in GitHub Desktop.
// ================================================
// 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