Skip to content

Instantly share code, notes, and snippets.

View canonic-epicure's full-sized avatar
💭
Well-typed API for the world

Nickolay Platonov canonic-epicure

💭
Well-typed API for the world
View GitHub Profile
Class('FileSystem', {
trait : JooseX.CPS,
continued : {
methods : {
save : function (data) {
Class('DataStore.Async', {
trait : JooseX.CPS,
continued : {
methods : {
log : function () {
Class('DataStore.Sync', {
methods : {
log : function () {
var response = // somehow get the response from logging operation
return response
},
// ================================================
// Joose classes, depending on Joose classes only
Class('Graphic.Circle', {
does : {
'Some.Joose.Role' : 0.01,
},
// ================================================
// 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,
// ================================================
// Using CommonJS modules in Joose - basic
Module('Graphic.Circle', function (module) {
// this == Graphic.Circle
// module == Graphic.Circle
var puts = require('sys').puts
// ================================================
// Using Joose in CommonJS modules
var Class = require('Task/Joose/Core').Class
exports.Circle = Class({
has : {
radius : {
is : 'rw',
init : '123'
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)
Module('Some.Module', {
VERSION : 0.01,
use : {
'Some.Another.Module' : 0.01,
'Yet.Another.Module' : 0.03
},
EXPORT : [ 'func1', 'func2' ],
var x = {}
typeof x == 'Object' //true
x === Object //false