Skip to content

Instantly share code, notes, and snippets.

Created March 11, 2011 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/866454 to your computer and use it in GitHub Desktop.
Save anonymous/866454 to your computer and use it in GitHub Desktop.
require('Task/Joose/NodeJS');
require('KiokuJS/Backend');
require('KiokuJS/Backend/CouchDB/Node');
require('KiokuJS/Feature/Class/OwnUUID');
use(['KiokuJS.Backend.CouchDB', 'KiokuJS.Linker'], function () {
var handle = new KiokuJS.Backend.CouchDB({
dbURL : 'http://10.0.0.1:5984/test'
});
var scope = handle.newScope();
Joose.Class("Model", {
does : KiokuJS.Feature.Class.OwnUUID,
trait : JooseX.CPS,
continued : {
methods : {
save : function () {
scope.store(this).now();
},
remove : function () {
scope.remove(this.getUuid()).now();
}
}
}
});
var model = new Model();
console.log("saving");
// works
scope.store(model).then(function () {
console.log("Saved, removing");
model.remove().now();
}).then(function () {
console.log("removed");
}).now();
// breaks
model.save().now();
});
/Users/adam/.local/lib/node/.jsan/Task/JooseX/CPS/All.js:174
if (statement.leaved) throw e
^
TypeError: Cannot call method 'hasValue' of null
at /Users/adam/.local/lib/node/.jsan/KiokuJS/TypeMap/Joose.js:64:31
at Object.<anonymous> (/Users/adam/.local/lib/node/.jsan/KiokuJS/TypeMap/Joose.js:38:22)
at Object.each (/Users/adam/.local/lib/node/.jsan/KiokuJS/Backend.js:128:22)
at [object Object].<anonymous> (/Users/adam/.local/lib/node/.jsan/KiokuJS/TypeMap/Joose.js:44:25)
at [object Object].eachAttribute (/Users/adam/.local/lib/node/.jsan/Task/Joose/Core.js:777:32)
at [object Object].<anonymous> (/Users/adam/.local/lib/node/.jsan/KiokuJS/TypeMap/Joose.js:63:18)
at [object Object].collapse (/Users/adam/.local/lib/node/.jsan/Task/Joose/Core.js:777:32)
at [object Object].<anonymous> (/Users/adam/.local/lib/node/.jsan/KiokuJS/Node.js:149:43)
at [object Object].collapse (/Users/adam/.local/lib/node/.jsan/Task/Joose/Core.js:777:32)
at [object Object].<anonymous> (/Users/adam/.local/lib/node/.jsan/KiokuJS/Collapser.js:145:18)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment