Skip to content

Instantly share code, notes, and snippets.

@canonic-epicure
Created August 29, 2010 07:36
Show Gist options
  • Save canonic-epicure/556075 to your computer and use it in GitHub Desktop.
Save canonic-epicure/556075 to your computer and use it in GitHub Desktop.
Class('Some.Class', {
trait : 'JooseX.Method.Remote.HTTP', // will include JooseX.CPS
has : {
attr : null
},
methods : {
localMethod : function () {}
},
remote : {
remoteMethod : {
url : '/some/class/remotemethod', // default
verb : 'POST', // default
serializer : KiokuJS.encode, // or function (args) { return string}
deserializer : KiokuJS.decode // or function (string) { return [ result ] }
}
}
})
var obj = new Some.Class()
obj.remoteMethod(1, 10).except(function (error) {
// exceptions
}).andThen(function (result) {
// result
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment