-
-
Save canonic-epicure/866489 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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
require('Task/Joose/NodeJS');
Joose.C = { debug : true }
use(['KiokuJS.Backend.CouchDB', 'KiokuJS.Feature.Class.OwnUUID', 'KiokuJS.Feature.Attribute.Skip'], function () {
var handle = new KiokuJS.Backend.CouchDB({
dbURL : 'http://local:5984/test'
});
var scope = handle.newScope();
Joose.Class("Model", {
does : KiokuJS.Feature.Class.OwnUUID,
trait : JooseX.CPS,
});
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();
});