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