Skip to content

Instantly share code, notes, and snippets.

@laser
Created April 21, 2014 22:24
Show Gist options
  • Save laser/11158659 to your computer and use it in GitHub Desktop.
Save laser/11158659 to your computer and use it in GitHub Desktop.
jquery RPC client
// Barrister Client Initialization
function initApp(callback) {
var client = Barrister.httpClient({
'endpoint': '/todos',
'interfaces': ['TodoManager']
});
client.loadContract(function() {
var proxy = client.proxy('TodoManager');
callback(null, proxy);
});
}
// API Client Usage (Barrister)
initApp(function(err, TodoManager) {
TodoManager.readTodos(function(err, todos) {
$('#todos').text(JSON.stringify(todos));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment