Skip to content

Instantly share code, notes, and snippets.

@canonic-epicure
Created March 11, 2011 20:15
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/866490 to your computer and use it in GitHub Desktop.
Save canonic-epicure/866490 to your computer and use it in GitHub Desktop.
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,
has : {
CONT : {
trait : KiokuJS.Feature.Attribute.Skip
}
},
continued : {
methods : {
save : function () {
scope.store({}).now();
},
remove : function () {
scope.remove(this.uuid).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();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment